如何让zencart的产品页面显示同类产品

如何让zencart的产品页面显示同类产品,第1张

首先找到zencart文件,在 includes/templates/你的模板目录/templates/下面创建一个文件 命名为tpl_product_info_similar.php

当然,也可以随便命名,把以下代码复制进去,

<div class="centerBoxWrapper" id="similar_product">

<h2 class="centerBoxHeading">Related Products</h2>

<ul>

<?php

$products_id = (int)$_GET['products_id']$flash_page_id_con = array()

$flash_page_images_con = array()

$flash_page_price_con = array()

$flash_page_name_con = array()$flash_page_query = "select

p.products_id,p.products_image,pd.products_name from " . TABLE_PRODUCTS ." p, ".

TABLE_PRODUCTS_DESCRIPTION . " pd where p.`products_id`=pd.`products_id` AND

pd.`language_id` = '" . (int)$_SESSION['languages_id'] . "' AND p.`master_categories_id` =

" . zen_get_products_category_id($products_id) . " ORDER BY rand() limit 12"

$flash_page = $db->Execute($flash_page_query)

while(!$flash_page->EOF){

$flash_page_items[] = $flash_page->fields

$flash_page_id_con[] = $flash_page->fields['products_id']

$flash_page_images_src = is_int(strpos($flash_page->fields

['products_image'],','))? substr($flash_page->fields['products_image'],0,strpos

($flash_page->fields['products_image'],',')):$flash_page->fields['products_image']

$flash_page_images_con[] = '"'.(zen_not_null($flash_page->fields

['products_image']) ? $flash_page_images_src : PRODUCTS_IMAGE_NO_IMAGE ).'"'

$flash_page_price_con[] = '"'.$currencies->display_price

(zen_get_products_base_price($flash_page->fields['products_id']),zen_get_tax_rate

($product_check->fields['products_tax_class_id'])).'"'

$flash_page_name_con[] = '"'.zen_output_string(zen_get_products_name

($flash_page->fields['products_id'])).'"'

$flash_page->MoveNext()

}

$flash_page_id = implode(",", $flash_page_id_con)

$flash_page_images = implode(",", $flash_page_images_con)

$flash_page_price = implode(",", $flash_page_price_con)

$flash_page_name = implode(",", $flash_page_name_con)

$flash_page_display_num = $flash_page->RecordCount()

?>

<?php for($i = 0$i<$flash_page_display_num $i++){?>

<li id="li<?php echo $i?>" style="display:blockfloat:leftpadding-

left:10pxwidth:160pxheight:160px">

<a href="http //taoge167 blog 163 com/blog/<?php echo zen_href_link(zen_get_info_page($flash_page_items[$i]

['products_id']), 'products_id=' . $flash_page_items[$i]['products_id'])?>"><?php echo

zen_image(DIR_WS_IMAGES . $flash_page_items[$i]['products_image'], $flash_page_items[$i]

['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTH,

IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT)?></a><p style="text-align:center"><a href="http //taoge167 blog 163 com/blog/<?php

echo zen_href_link(zen_get_info_page($flash_page_items[$i]['products_id']), 'products_id='

. $flash_page_items[$i]['products_id'])?>"><?php echo $flash_page_items[$i]

['products_name']?></a><br /><strong id="cell_price<?php echo $i?>" class="red"><?php

echo $currencies->display_price((zen_get_products_base_price($flash_page_items[$i]

['products_id']) == 0 ? zen_get_products_sample_price($flash_page_items[$i]

['products_id']): zen_get_products_base_price($flash_page_items[$i]

['products_id'])),zen_get_tax_rate($product_check->fields['products_tax_class_id']))?></strong></p>

</li>

<?php

//print_r($flash_page_items[$i])

}

?>

</ul>

</div>

<div style="clear:bothheight:1px"/>

然后,在zen-cart模板目录中的includes/templates/你的模板目录/templates/tpl_product_info_display.php 中 修改一些内容

找到 <!–bof also purchased products module–>

<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php')?>

<!–eof also purchased products module–>

在他的后面添加

<!–bof similar products–>

<?php require($template->get_template_dir('tpl_product_info_similar.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_product_info_similar.php')?>

<!–eof similar products–>

这样,就可以实现在zencart模板中的产品详细页显示同类的产品,以增加搜索引擎收录,有益于zencart的seo优化了。

正常是使用ems做为运输方式,以下是根据件数设置运费的方法

1.找到modules----shipping

2.安装ems运输模块

3.设置Calculation Method为 "Item"

4.Zone 1 Countries填写国家代码(比如us)

5.Zone 1 Shipping Table 运费设置(比如1:20,2:25,3:30)意思是1件20美金,2件25美金,3件30美金,以此类推!


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11352000.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存