模块覆盖在zen购物车中

时间:2013-11-19 06:22:04

标签: module zen-cart

我是Zen Cart的新手,目前正在开发一个拥有自定义模板的项目。我现在停留在模块文件new_products.php的覆盖!如何覆盖new_products.php?我想在其中更改HTML。我该怎么做 ?我在new_products.php本身做了更改。我知道这不是正确的方法,但我很困惑,我在哪里更改/覆盖模块文件?

以下是我在主要new_products.php文件中进行更改的代码

while (!$new_products->EOF) {
$products_price = zen_get_products_display_price($new_products->fields['products_id']);
if (!isset($productsInCategory[$new_products->fields['products_id']])) $productsInCategory[$new_products->fields['products_id']] = zen_get_generated_category_path_rev($new_products->fields['master_categories_id']);

$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' :  '<center><h2>'.$new_products->fields['products_name'].'</h2><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a></center>') . '<h3>' . $products_price.'</h3><p>'.$new_products->fields['products_description'].'</p>
    <div class="button black"><a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">Add To Cart' .'</div>');

$col ++;
if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) {
  $col = 0;
  $row ++;
}
$new_products->MoveNextRandom();}

1 个答案:

答案 0 :(得分:2)

修改new_products.php完全没问题,但首先要复制

includes/modules/new_products.php 

includes/modules/YOUR_TEMPLATE/new_products.php 

(其中YOUR_TEMPLATE是自定义模板的名称)。

然后在文件中进行更改

includes/modules/YOUR_TEMPLATE/new_products.php 

您可以转到admin-&gt; tools-&gt;模板选择来确定您的模板名称。

如果您不知道如何在Zen Cart中创建自定义模板,请阅读: http://www.zen-cart.com/content.php?180