存档在 ‘Zencart’ 分类

Zencart模板之圣诞风格

2008年4月11日

在国外的一个论坛里看到的圣诞风格的Zencart模板,感觉还不错,貌似在Zencart官方的论坛里也有,不过我想还是发出来吧,包括有全部的PSD图片稿,大家下回去可以随便改,虽然这个时节发布圣诞风格的模板有点不是很恰当的感觉,呵呵~但TOM是个手痒痒的人,觉得还不错了,总希望拿出来大家用! PS:说的自己好伟大啊…..自恋一下!嘿嘿!

  ZencartCristmas (1.7 MiB, 467 hits)
You need to be a registered user to download this file.

如何设计你的Zencart模板

2008年4月11日

很多朋友爱刚接触到Zencart的时候总感觉太麻烦,特别是入门阶段,在安装后系统后,看到默认的模板自然是不会太喜欢,但一看到别人的很漂亮的站,又恨不能自己马上DIY一个模板出来,TOM在这收集了些从网络上找来的关于DIY你的Zencart模板需要了解的文档资料和对应的文件注释,希望对大家有帮助! :)

具体的认知步骤可以分为以下几点:
首先要阅读常见问答部分的:如何添加、制作新模板。 Zen Cart的设计没有什么特别,与以前设计HTML页面是一样的。只是整个页面分成了好几个部分,并加入了PHP代码。

通常,页面分为页眉(header),页脚(footer),边框(sideboxes)。所以设计页面的时候,要记住Zen Cart是如何组织这些页面的。

页面是通过CSS样式表来控制的。样式表控制表格单元的背景图案、字体的颜色和样式等等。所以,假如你需要修改边框标题栏的字体,那么查看样式表文件。

Zen Cart在页面添加图像有两种方式。可以使用图像目录的相对路径,或者在模板中用php变量定义图像。如果你使用https服务器,并且采用相对图像路径,那么https的图像目录下也要有同样的图像,否则https服务器很可能会给出警告提示。
www.444p.com
Zen Cart可以设置成任意的html/flash的界面,只是比通常的html页面的设计费时。你可以从修改缺省的模板开始,先修改CSS文件和三栏格式的界面。开始先采用不同的颜色,很快就可以设计出完全不同的风格。

最后,在设计模板前要先计划好你网页的内容,这样你的设计就会很快了。

下面是zen cart页面各部分相对应模板文件的一个列表:

文件路径 注释
index.php 主文件
includes/templates/[custom template folder]/common/html_header.php 页面的head部分
includes/templates/[custom template folder]/common/tpl_main_page.php 页面的body部分
includes/templates/[custom template folder]/common/tpl_header.php 所有页面的页眉
(column left)  
includes/templates/[custom template folder]/common/main_template_vars.php 决定页面的内容部分,缺省为 ‘tmp_index_default.php’
首页 – 缺省
includes/templates/[custom template folder]/templates/tmp_index_default.php 首页模板文件
首页 – 显示分类
includes/templates/[custom template folder]/templates/tpl_index_categories.php 首页上显示分类时的模板文件
includes/modules/[custom template folder]/pages/index/category_row.php 选择要显示的分类
includes/templates/[custom template folder]/templates/tpl_index_category_row.php 显示分类
首页 – 显示指定分类
includes/templates/[custom template folder]/templates/tpl_index_product_list.php 首页上显示指定的分类时采用的模板文件
includes/modules/[custom template folder]/product_listing.php 将商品数据添加到数组
includes/templates/[custom template folder]/templates/tpl_modules_product_listing.php 显示商品数量和商品导航菜单
includes/templates/[custom template folder]/common/tpl_list_box_content.php 显示商品数组
商品信息页面
includes/templates/[custom template folder]/templates/tpl_product_info_display.php 显示单件商品信息
购物车页面
includes/templates/[custom template folder]/templates/tpl_shopping_cart_default.php 购物车页面
(column right)  
includes/templates/[custom template folder]/common/tpl_footer.php 所有页面的页脚

Zencart定单时间与随机数结合产生订单号

2008年4月9日

不少使用Zencart的朋友发现Zencart的系统默认定单号并不一定是大家想要的,很多人希望通过定单时间来确定不同的定单号以方便管理和使用,这里发布下目前适合1.38版本的定单时间+随机数字结合产生定单号的方法,在includes\classes\order.php 里需要做出如下的代码调整,注意: 修改前请一定要备份好数据库,以防出现调整错误.

具体方法,在order.php里:

function create($zf_ot_modules, $zf_mode = 2) {
  global $db;

/*——按时间+随机数结合产生订单号—–*/
$t1 = date("Ymd");
srand ((float) microtime() * 10000000);
$input = array ("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
$rand_keys = array_rand ($input, 2);
//$t1 = $input[$rand_keys[0]];
$t2 = $input[$rand_keys[1]];
$t3 = rand(0,9);

$ordernum = $t1.$t2.$t3;
/*————END————————*/

  if ($this->info['total'] == 0) {
    if (DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID == 0) {
    $this->info['order_status'] = DEFAULT_ORDERS_STATUS_ID;
    } else {
    $this->info['order_status'] = DEFAULT_ZERO_BALANCE_ORDERS_STATUS_ID;
    }
  }

  if ($_SESSION['shipping'] == ‘free_free’) {
    $this->info['shipping_module_code'] = $_SESSION['shipping'];
  }

/*在这里添加orders_id字段,手工插入:*/
  $sql_data_array = array(‘orders_id’ => $ordernum,
                  ‘customers_id’ => $_SESSION['customer_id'],
                  ‘customers_name’ => $this->customer['firstname'] . ‘ ‘ . $this->customer['lastname'],
                  ‘customers_company’ => $this->customer['company'],
                  ‘customers_street_address’ => $this->customer['street_address'],
                  ‘customers_suburb’ => $this->customer['suburb'],
                  ‘customers_city’ => $this->customer['city'],
                  ‘customers_postcode’ => $this->customer['postcode'],
                  ‘customers_state’ => $this->customer['state'],
                  ‘customers_country’ => $this->customer['country']['title'],
                  ‘customers_telephone’ => $this->customer['telephone'],
                  ‘customers_email_address’ => $this->customer['email_address'],
                  ‘customers_address_format_id’ => $this->customer['format_id'],
                  ‘delivery_name’ => $this->delivery['firstname'] . ‘ ‘ . $this->delivery['lastname'],
                  ‘delivery_company’ => $this->delivery['company'],
                  ‘delivery_street_address’ => $this->delivery['street_address'],
                  ‘delivery_suburb’ => $this->delivery['suburb'],
                  ‘delivery_city’ => $this->delivery['city'],
                  ‘delivery_postcode’ => $this->delivery['postcode'],
                  ‘delivery_state’ => $this->delivery['state'],
                  ‘delivery_country’ => $this->delivery['country']['title'],
                  ‘delivery_address_format_id’ => $this->delivery['format_id'],
                  ‘billing_name’ => $this->billing['firstname'] . ‘ ‘ . $this->billing['lastname'],
                  ‘billing_company’ => $this->billing['company'],
                  ‘billing_street_address’ => $this->billing['street_address'],
                  ‘billing_suburb’ => $this->billing['suburb'],
                  ‘billing_city’ => $this->billing['city'],
                  ‘billing_postcode’ => $this->billing['postcode'],
                  ‘billing_state’ => $this->billing['state'],
                  ‘billing_country’ => $this->billing['country']['title'],
                  ‘billing_address_format_id’ => $this->billing['format_id'],
                  ‘payment_method’ => (($this->info['payment_module_code'] == ” and $this->info['payment_method'] == ”) ? PAYMENT_METHOD_GV : $this->info['payment_method']),
                  ‘payment_module_code’ => (($this->info['payment_module_code'] == ” and $this->info['payment_method'] == ”) ? PAYMENT_MODULE_GV : $this->info['payment_module_code']),
                  ’shipping_method’ => $this->info['shipping_method'],
                  ’shipping_module_code’ => (strpos($this->info['shipping_module_code'], ‘_’) > 0 ? substr($this->info['shipping_module_code'], 0, strpos($this->info['shipping_module_code'], ‘_’)) : $this->info['shipping_module_code']),
                  ‘coupon_code’ => $this->info['coupon_code'],
                  ‘cc_type’ => $this->info['cc_type'],
                  ‘cc_owner’ => $this->info['cc_owner'],
                  ‘cc_number’ => $this->info['cc_number'],
                  ‘cc_expires’ => $this->info['cc_expires'],
                  ‘date_purchased’ => ‘now()’,
                  ‘orders_status’ => $this->info['order_status'],
                  ‘order_total’ => $this->info['total'],
                  ‘order_tax’ => $this->info['tax'],
                  ‘currency’ => $this->info['currency'],
                  ‘currency_value’ => $this->info['currency_value'],
                  ‘ip_address’ => $_SESSION['customers_ip_address'] . ‘ – ‘ . $_SERVER['REMOTE_ADDR']
                  );

  zen_db_perform(TABLE_ORDERS, $sql_data_array);

  /*修改原来的调用自动插入函数为$ordernum变量*/
  $insert_id = $ordernum;

//   $insert_id = $db->Insert_ID();

这样以来,一个较为完善的根据顾客下单时间与系统随机数生成的定单号即生成了,有朋友说在1.38a貌似有BUG和不完善的地方,我这还没来的及看到,PS:默认其实我是在1.37下改进的,但1.38的版本里关于order.php相关函数无多大变化,这里顺推应该可以在1.38下正常使用的.