Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Product Listing Sidebox Rate Topic   - - - - -

 
  • WebGuy
  • Senior Member
  • Members
  • Join Date: 02-Dec 08
  • 419 posts

Posted 24 May 2011 - 09:13 PM #1

Because I'm only selling 6-7 products I would like to replace the Category sidebox with a Product sidebox, which has the same style as the Category sidebox.

I know you can create a Product Listing in Listmania but that only lists the links to the products without the "sidebox style". So Listmania doesn't work for what I need

I created a sidebox/products.tpl file and this is my code so far:
However it's not pulling in the products?

What am I missing?

{capture name="sidebox"}
<ul>
{foreach from=$products item=product}
<li><a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}">{$product.product}</a></li>
{/foreach}
</ul>

{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.products content=$smarty.capture.sidebox icon="sidebox_icon_catalog.gif"}

WebGuy
www.nutraceaonline.com
CS-CART VERSION: 1.3.5 SP4

 
  • WebGuy
  • Senior Member
  • Members
  • Join Date: 02-Dec 08
  • 419 posts

Posted 01 June 2011 - 11:27 PM #2

Ok for those of you still using 1.3.5SP4 Here is what I did:

Create a new products.tpl file in customer/sideboxes

with this code:
{capture name="sidebox"}
<ul>
{foreach from=$menu_products item=product}
<li><a href="{$index_script}?{$target_name}=products&product_id={$product.product_id}">{$product.product}</a></li>
{/foreach}
</ul>

{/capture}
{include file="common_templates/sidebox.tpl" title=$lang.products content=$smarty.capture.sidebox icon="sidebox_icon_catalog.gif"}

next edit in include/common/customer_common.php
add this line of code:
include COMMON_DIR . 'products.php';

right under this line: include COMMON_DIR . 'topics.php';

next edit in include/common/products.php
(we're building the menu system for products here)
add this code right after: if ( !defined('IN_CSCART') ) { die('Access denied'); }

$menu_sortings = array (
	'code' => 'products.product_code',
	'avail' => 'products.avail',
	'product' => 'descr1.product',
	'position' => ($settings['General']['improved_product_search'] == 'Y') ? 'avail_products.position' : 'products_categories.position',
	'price' => 'prices.price',
	'list_price' => 'products.list_price',
	'weight' => 'products.weight',
	'amount' => 'products.amount'
);

$menu_directions = array (
	'asc' => 'asc',
	'desc' => 'desc'
);

$menu_sort_order = 'asc';

$menu_sort_by = 'product';
$menu_sorting = "ORDER BY " .$menu_sortings[$menu_sort_by]. " " .$menu_directions[$menu_sort_order];
$menu_fields = "products.product_id, descr1.product as product";
$menu_join = '';

$lang_code = !empty($lang_code) ? $lang_code : $cart_language;

$menu_join .= " LEFT JOIN $db_tables[product_descriptions] as descr1 ON descr1.product_id=products.product_id AND descr1.lang_code='$lang_code' ";
$menu_p_avails = array('Y');
$menu_c_avails = array('Y' , 'H');

$menu_avail_cond = (AREA == 'C') ? " AND $db_tables[categories].membership_id IN ('0', '$auth[membership_id]') AND $db_tables[categories].avail IN ('" . implode("','", $menu_c_avails) . "')" : '';

$menu_avail_cond .= (AREA == 'C' || defined('HTML_CATALOG')) ? " AND products.avail IN ('" . implode("','", $menu_p_avails) . "')" : '';
$menu_join .= "INNER JOIN $db_tables[products_categories] as products_categories ON products_categories.product_id=products.product_id INNER JOIN $db_tables[categories] ON $db_tables[categories].category_id=products_categories.category_id $menu_avail_cond";
$menu_products = db_get_array("SELECT $menu_fields FROM $db_tables[products] as products $menu_join GROUP BY products.product_id $menu_sorting");
$smarty->assign('menu_products', $menu_products);

Last go to your main.tpl and add this line to which ever side you'd like the product listings on:

{include file="side_boxes/products.tpl"}

Of course you'll have to adjust your style sheet if you want it to look different, and you can even make it look like your categories menu.

Hope this helps someone, but I think by now everyone is using the new version of CS-Cart, right? :rolleyes:
WebGuy
www.nutraceaonline.com
CS-CART VERSION: 1.3.5 SP4

 
  • Struck
  • Teetering on Genious
  • Members
  • Join Date: 07-Mar 09
  • 2502 posts

Posted 02 June 2011 - 01:42 AM #3

Hope this helps someone, but I think by now everyone is using the new version of CS-Cart, right?


There are only two of you in existence not running 2.1.x !

You know not what you are missing......

Welcome back Webguy! ;)
Cooking with Gas on Version 4.1.2 (But proceeding with caution....)

 
  • WebGuy
  • Senior Member
  • Members
  • Join Date: 02-Dec 08
  • 419 posts

Posted 02 June 2011 - 02:54 PM #4

Really??

I wonder who the other one is...

Anyway, I've just have too much invested in 1.3.5sp4 to move, maybe someday...but you know what they say "if it ain't broke, don't fix it". :cool:
WebGuy
www.nutraceaonline.com
CS-CART VERSION: 1.3.5 SP4