2013-04-09 63 views
2

我想了解如何手动将产品型号添加到zencart中类别产品列表中的每个标题,而不是让型号出现在其中自己的专栏。手动添加“产品型号”号码到Zen Cart中的产品清单

看来,使用的任何实例:

$listing->fields['products_model'] 
在“product_listing.php”文件将只工作

当管理员的参数发送到正确的。这很好,但是我得到了产品模型的两个实例。一个在它自己的列(我不想)中有一个变量,另一个是我把变量放在其他地方。

以下是我所指的部分,您会注意到为模型设置了一个具有自己的列的案例,但是我希望将它放在产品列表名称案例的标题之前,柱。

for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { 
    $lc_align = ''; 
    switch ($column_list[$col]) { 
     case 'PRODUCT_LIST_MODEL': 
     $lc_align = ''; 
     $lc_text = $listing->fields['products_model']; 
     break; 
     case 'PRODUCT_LIST_NAME': 
     $lc_align = ''; 
     $lc_text = '<h3 class="itemTitle"><a href="'.zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3> 

有没有一种方法,我可以引用型号和地方在标题的每一行,同时绕过参数在管理设置?

任何帮助将不胜感激。

+0

也许一个更简单的方法来放置它:是否有一种方便的方法来覆盖变量上的参数集,以便它显示而不管参数设置为什么? – cclark413 2013-04-09 16:21:14

回答

1

过了一段时间,我已经想出了我自己的问题的答案。这实际上比我想象的要容易得多。希望这可以帮助那些想要做同样事情的人。

转到“包括/ index_filters/default_filter.php:

从我所知,这是所有查询都为制造‘产品列表’模块显示两个特定类别或制造商名单。在默认情况下,当前查询不包括“p.products_model”简单地添加在每个查询列标识符(总共4个位置:类别,类别:所有,制造商,制造商:所有)。

实施例:

// We are asked to show only specific category 
    $listing_sql = "select " . $select_column_list . " p.products_id, p.products_model, p.products_type, p.master_categories_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, pd.products_description, IF(s.status = 1, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status = 1, s.specials_new_products_price, p.products_price) as final_price, p.products_sort_order, p.product_is_call, p.product_is_always_free_shipping, p.products_qty_box_status 
    from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . 
    TABLE_PRODUCTS_DESCRIPTION . " pd, " . 
    TABLE_MANUFACTURERS . " m, " . 
    TABLE_PRODUCTS_TO_CATEGORIES . " p2c 
    where p.products_status = 1 
    and p.manufacturers_id = m.manufacturers_id 
    and m.manufacturers_id = '" . (int)$_GET['filter_id'] . "' 
    and p.products_id = p2c.products_id 
    and pd.products_id = p2c.products_id 
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
    and p2c.categories_id = '" . (int)$current_category_id . "'" . 
    $alpha_sort; 
} 

从那里,您可以在任何地方都可以调用产品型号代码“$ listing-> fields ['products_model']”,而管理后端中的参数不会中断显示。就我而言,我将它直接包含在模块中的“product_listing.php”文件中的产品名称下。

例子:

$lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div id=\"listing_model\">Item Code: ' .$listing->fields['products_model'] . '</div> 

希望这可以帮助别人。为什么他们让你最初有一个产品模型的列是超出我的,因为“列出新”和“全部列出”都显示在与标题和说明相同的列中。

1

我的产品型号($ listing->字段[“products_model”])只是附加到产品名称:

case 'PRODUCT_LIST_NAME': 
    $lc_align = ''; 
    $lc_text = '<h3 class="itemTitle"><a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'cPath=' . (($_GET['manufacturers_id'] > 0 and $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : ($_GET['cPath'] > 0 ? zen_get_generated_category_path_rev($_GET['cPath']) : zen_get_generated_category_path_rev($listing->fields['master_categories_id']))) . '&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '[' . $listing->fields['products_model'] . ']' . '</a></h3><div class="listingDescription">' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>'; 
    break; 

记住然后在Zen Cart的管理员关闭型号编号栏。

我还没有在Zen Cart中测试过它 - 希望它有帮助。

+0

再次Kerrin。这只有在Admin中打开模型列时才有效。因此,您最终在标题和列(我不想要)中输入型号。如果不是,它只是显示了你在代码中包含的括号。关于如何禁止一起创建列的任何想法? – cclark413 2013-06-18 16:17:36

+0

让我在我的演示Zen Cart中玩一玩,然后我可以在这里放置**测试的**解决方案:) – kerrin 2013-06-20 01:49:28

+0

非常好,非常感谢你...... – cclark413 2013-06-21 14:04:05