![]() |
help with products_list.tpl problem, repeating product?
My current tpl looks like this;
{* $Id: products_list.tpl,v 1.4.2.5 2010/12/15 11:57:05 aim Exp $ vim: set ts=2 sw=2 sts=2 et: *} <div class="products products-list"> {foreach from=$products item=product name=products} <script type="text/javascript"> //<![CDATA[ products_data[{$product.productid}] = {ldelim}{rdelim}; //]]> </script> {if $active_modules.Product_Configurator and $is_pconf and $current_product} {assign var="url" value="product.php?productid=`$product.productid`& amp;pconf=`$current_product.productid`&slot=`$ slot`"} {else} {assign var="url" value="product.php?productid=`$product.productid`& amp;cat=`$cat`&page=`$navigation_page`"} {if $featured eq 'Y'} {assign var="url" value=$url|cat:"&featured=Y"} {/if} {/if} <div{interline name=products additional_class=item}> <div class="image"{if $config.Appearance.thumbnail_width gt 0 or $product.tmbn_x gt 0} style="width: {$max_images_width|default:$config.Appearance.thum bnail_width|default:$product.tmbn_x}px;"{/if}> <a href="{$url}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a> {if $active_modules.Special_Offers} {include file="modules/Special_Offers/customer/product_offer_thumb.tpl"} {/if} <a href="{$url}" class="see-details">{$lng.lbl_see_details}</a> {if $active_modules.Feature_Comparison} {include file="modules/Feature_Comparison/compare_checkbox.tpl"} {/if} </div> <div class="details"{if $config.Appearance.thumbnail_width gt 0 or $product.tmbn_x gt 0} style="margin-left: {$max_images_width|default:$config.Appearance.thum bnail_width|default:$product.tmbn_x}px;"{/if}> <a href="{$url}" class="product-title">{$product.product|amp}</a> <tr> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> </tr> {if $config.Appearance.display_productcode_in_list eq "Y" and $product.productcode ne ""} <div class="sku">{$lng.lbl_sku}: <span class="sku-value">{$product.productcode|escape}</span></div> {/if} <div class="descr">{$product.descr|amp}</div> {if $product.rating_data} {include file="modules/Customer_Reviews/vote_bar.tpl" rating=$product.rating_data productid=$product.productid} {/if} <hr /> {if $product.product_type eq "C"} {include file="customer/buttons/details.tpl" href=$url} {else} {if $active_modules.Subscriptions ne "" and ($product.catalogprice gt 0 or $product.sub_priceplan gt 0)} {include file="modules/Subscriptions/subscription_info_inlist.tpl"} {else} {if not $product.appearance.is_auction} {if $product.appearance.has_price} <div class="price-row{if $active_modules.Special_Offers ne "" and $product.use_special_price ne ""} special-price-row{/if}"> <span class="price">{$lng.lbl_our_price}:</span> <span class="price-value">{currency value=$product.taxed_price}</span> <span class="market-price">{alter_currency value=$product.taxed_price}</span> </div> {if $product.appearance.has_market_price and $product.appearance.market_price_discount gt 0} <div class="market-price"> {$lng.lbl_market_price}: <span class="market-price-value">{currency value=$product.list_price}</span> {if $product.appearance.market_price_discount gt 0} {if $config.General.alter_currency_symbol ne ""}, {/if} <span class="price-save">{$lng.lbl_save_price} {$product.appearance.market_price_discount}%</span> {/if} </div> {/if} {if $product.taxes} <div class="taxes"> {include file="customer/main/taxed_price.tpl" taxes=$product.taxes is_subtax=true} </div> {/if} {/if} {if $active_modules.Special_Offers ne "" and $product.use_special_price ne ""} {include file="modules/Special_Offers/customer/product_special_price.tpl"} {/if} {else} <span class="price">{$lng.lbl_enter_your_price}</span><br /> {$lng.lbl_enter_your_price_note} {/if} {/if} {if $active_modules.Product_Configurator and $is_pconf and $current_product} {include file="modules/Product_Configurator/pconf_add_form.tpl"} {elseif $product.appearance.buy_now_enabled and $product.product_type ne "C"} {if $login ne ""} {include_cache file="customer/main/buy_now.tpl" product=$product cat=$cat featured=$featured is_matrix_view=$is_matrix_view login="1" smarty_get_cat=$smarty.get.cat smarty_get_page=$smarty.get.page smarty_get_quantity=$smarty.get.quantity} {else} {include_cache file="customer/main/buy_now.tpl" product=$product cat=$cat featured=$featured is_matrix_view=$is_matrix_view login="" smarty_get_cat=$smarty.get.cat smarty_get_page=$smarty.get.page smarty_get_quantity=$smarty.get.quantity} {/if} {/if} {/if} </div> <div class="clearing"></div> </div> {/foreach} </div> and, it's creating an output like this; <tr> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="product.php?productid=12&cat=&page=1">LC-57BK</a><br/><img src="http://5dollarinkcartridges.com.au/newsite/image.php?id=12" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="product.php?productid=12&cat=&page=1">LC-57BK</a><br/><img src="http://5dollarinkcartridges.com.au/newsite/image.php?id=12" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="product.php?productid=12&cat=&page=1">LC-57BK</a><br/><img src="http://5dollarinkcartridges.com.au/newsite/image.php?id=12" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="product.php?productid=12&cat=&page=1">LC-57BK</a><br/><img src="http://5dollarinkcartridges.com.au/newsite/image.php?id=12" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="product.php?productid=12&cat=&page=1">LC-57BK</a><br/><img src="http://5dollarinkcartridges.com.au/newsite/image.php?id=12" width="75"></td> </tr> instead of using a new product, product image, and product code, etc, it's repeating the same one 6 times, and then starting on another product. how can i use 6 different products inside 1 row??!! please help! |
Re: help with products_list.tpl problem, repeating product?
We got this. :) Go to Settings->General Settings->Appearance
Look for: Number of columns to display the product list in and chabge this value to 6. Now go fix your product_list.tpl back to default. The code you posted above, is based on a{foreach} loop that is looping through the product array. |
Re: help with products_list.tpl problem, repeating product?
Ok, I've done that, and it completely messes up my site's design.
How would I go about editing my template file, so it ONLY shows; <tr> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> </tr> and does this for every new 6 sets of products? I just want the image, product code, and product URL shown. How would I go about achieving this? |
Re: help with products_list.tpl problem, repeating product?
I reverted all my files back to original. How do I go about accomplishing what I am trying to do?
|
Re: help with products_list.tpl problem, repeating product?
You can see my edits here; http://5dollarinkcartridges.com.au/newsite/manufacturers.php?manufacturerid=3
It's running off the page becaue the products list is so big. I just want product code, image, and link in a table format. I've already pasted the code I want to use, as well. How do I go about this? |
Re: help with products_list.tpl problem, repeating product?
What you are asking for is not easy, the question seems simple, but the answer might take pages of text to explain to someone new. Let me try to shed some light on why what you did didn't work, and that should help you figure out how to make it work.
See this: {foreach from=$products item=product name=products}--starts an array loop through the items. So anything called inside this like {$product.productcode|escape} will spit out the current product code for this iteration of the loop. {/foreach}--Ends the loop. So to do what you want (This is an example not actual code) Code:
<tr> The problem with this mindset, is it doesn't allow for starting another row. What if you had 10 products, or 100? What I directed you to before "Number of columns to display the product list" should activate a template called products_t.tpl. take a look at this to see how a properly formatted table with multiple columns is handled. I think you are only struggling with this due to template customizations. Perhaps you should switch templates back to a default one, just to observe the behavior of multi-column formatting of products, as controlled by the number of columns setting in the admin. I don't think any designer should have interfered with this basic functionality when building the template. I know this probably raises more questions than it answers...but hopefully some of it makes sense. |
Re: help with products_list.tpl problem, repeating product?
So, which file do I need to edit to accomplish what I am trying to do? Only products_t.tpl?
|
Re: help with products_list.tpl problem, repeating product?
I searched for "
foreach from=$products item=product name=products" on products_t.tpl, and I could not find that code. I could only find it on products_list.tpl? |
Re: help with products_list.tpl problem, repeating product?
Cool lets look at that file and disect it starting from the top.
Code:
{list2matrix assign="products_matrix" assign_width="cell_width" list=$products row_length=$config.Appearance.products_per_row} Right below that you can see it defining a foreach loop Code:
{foreach from=$products_matrix item=row name=products_matrix} Then we see: Code:
{foreach from=$row item=product name=products} Now look down the code, you will see the 2nd foreach statement is closing. {/foreach} This entire first foreach statement simply displays the product codes, so for your intents and purposes you could remove it completely. The next foreach finally has some meat in it, the product thumbnails and links. They are called from customer/main/program_thumbnail.tpl with an include statement. Of course I could go on, but hopefully you are seeing the pattern. It is not madness, it does make sense after you understand the concepts. :) |
Re: help with products_list.tpl problem, repeating product?
Inside products_t.tpl, I did this;
{foreach from=$row item=product name=products} {if $product} <td{interline name=products additional_class="product-cell"} style="width: {$cell_width}%;"> <script type="text/javascript"> //<![CDATA[ products_data[{$product.productid}] = {ldelim}{rdelim}; //]]> </script> <a href="{$product.alt_url|default:$product.page_url| amp}" class="product-title">{$product.productcode|escape}</a> </td> {/if} {/foreach} and, it's not seeming to show the product code for some reason? |
Re: help with products_list.tpl problem, repeating product?
How would I best cut everything out of the templates, and only display the table I am wanting to display? I have provided you code earlier. Can I just make a blank products_t.tpl, or does this also require other files?
|
Re: help with products_list.tpl problem, repeating product?
I would try using this code;
<tr> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> <td class="PrinterDescriptionText" style="border-width:0px;"><a href="{$url}">{$product.productcode|escape}</a><br/><img src="{$http_location}/image.php?id={$product.productid}" width="75"></td> </tr> inside /public_html/newsite/skin/common_files/modules/Manufacturers/customer_manufacturer_products.tpl but it does not seem to work? |
Re: help with products_list.tpl problem, repeating product?
No, that is not going to work. Don't try to empty everything out and start with a blank, just edit what is there to achieve the desired effect.
What I would do, is first use webmaster mode, to ensure that products_t.tpl is the template that is displaying the table that you are trying to change. Then simply enable Admin->General Settings->Appearance->Display product code (SKU) in the products list. Now in products_t.tpl line 23 see this: Code:
<div class="sku">{$lng.lbl_sku}: {$product.productcode|escape}</div> |
Re: help with products_list.tpl problem, repeating product?
Ok, i did this;
<div class="sku"><a href="{$url}">{$product.productcode|escape}</a></div> and i turned on the SKU from the backend. Now it's showing like this; SKU: LC-57BK without any hyperlink to it. WTF? |
Re: help with products_list.tpl problem, repeating product?
Xcart has caches yes one way to clear them is: http://5dollarinkcartridges.com.au/newsite/cleanup.php
But I think the issue is just that we are working with the wrong tpl. I doing my best to teach you what I know of this system, sometimes I forget that people need to know the basics first. The first thing I do is make sure I am working in the right tpl. It is probably customer_manufacturer_products.tpl just as you said. You can use webmaster mode to determine what tpl's are being called on what page. It also gives you a list of variables and there values. Lets make sure that we are working in the right section, when you referred to products_list.tpl I immediately assumed that you were working inside a category. (oops) :-) Familiarize yourself with webmaster mode, take note of all the templates on the page and what each one controls. |
Re: help with products_list.tpl problem, repeating product?
Ah. I was editing the wrong files! It seems to be linking the SKU, now.
Now, how do I drop EVERYTHING else, get rid of the boxes, everything else, except the pictures of all the products? |
Re: help with products_list.tpl problem, repeating product?
Glad we are getting on the right track. Can you link to the page you are working on, and tell me what template you are editing?
|
Re: help with products_list.tpl problem, repeating product?
http://5dollarinkcartridges.com.au/newsite/manufacturers.php?manufacturerid=3
using products_t.tpl I just want to show the SKU, linked to the product, and then a picture below it of the product. THAT'S ALL. |
Re: help with products_list.tpl problem, repeating product?
Before we go any further, do you realize that this template may be used in other sections? Like the home page or a category page. Look at:
http://5dollarinkcartridges.com.au/newsite/home.php?cat=4 The categories are being displayed according to products_t.tpl I believe, due to the setting of Number of Columns in Appearance section. If you were to remove the number of columns setting, this category page would most likely be displayed using the products_list.tpl If you want to edit the display in just this section, make a copy of products_t.tpl and call it products_t_manu.tpl or whatever. Then look in the template that is calling the products_t.tpl on your manufacturers page, it will be something like {include file="customer/main/products_t.tpl"} change this to reference your new tpl. Look in your new tpl. Move this row: Code:
<tr{interline name=products_matrix}> Delete or comment out: Code:
{if $active_modules.Customer_Reviews and $rating_data_exists} Comments are controlled by {* This is a comment it can be multi-line *} Use comments to non-destructively edit the code, while learning what controls what, instead of deleting you can first comment it out to see how it behaves. I think I have steered you close to the answer now, you will need to continue to look through and eliminate a row at a time. |
Re: help with products_list.tpl problem, repeating product?
How do I include products_t.tpl into /public_html/newsite/skin/common_files/modules/Manufacturers/customer_manufacturer_products.tpl ?
{include file="customer/main/products_t.tpl"} ? |
Re: help with products_list.tpl problem, repeating product?
Yes that looks like the right way to do it.
|
Re: help with products_list.tpl problem, repeating product?
Do you see how the table is too large? How do i limit the table size, and remove ;
Products Sort by: SKU - products, etc at the top? It seems this part is causing the table too large, plus I don't need it. I just want SKU, link, and picture. Which template file do i need to edit to remove this? |
Re: help with products_list.tpl problem, repeating product?
Ok, when I only included products_t.tpl, it did what I wanted to do.
Now, how do I change the table width so it's not stretching across the screen? |
Re: help with products_list.tpl problem, repeating product?
currently it's set to width-100 ? i believe?
|
Re: help with products_list.tpl problem, repeating product?
I think somehow I need to edit this?
<table cellspacing="3" class="products products-table width-100" summary="{$lng.lbl_products_list|escape}"> |
Re: help with products_list.tpl problem, repeating product?
It looks like {include file="customer/main/navigation.tpl"}
in /common_files/modules/Manufacturers/customer_manufacturer_products.tpl But I don't have a store with manufacturers enabled so I can't be sure. |
Re: help with products_list.tpl problem, repeating product?
Sorry that last post was in response to #22.
Yes now you can just use css styles to influence your design. |
Re: help with products_list.tpl problem, repeating product?
Do you mind looking at my code, and telling me what you think is wrong with my design? The products_t.tpl is throwing off my design!!!
Here's my products_t.tpl file; {* $Id: products_t.tpl,v 1.3.2.5 2010/12/15 11:57:05 aim Exp $ vim: set ts=2 sw=2 sts=2 et: *} {list2matrix assign="products_matrix" assign_width="cell_width" list=$products row_length=$config.Appearance.products_per_row} {assign var="is_matrix_view" value=true} {if $products_matrix} <table cellspacing="3" class="products products-table width-100" summary="{$lng.lbl_products_list|escape}"> {foreach from=$products_matrix item=row name=products_matrix} <tr{interline name=products_matrix additional_class="product-name-row"}> {*Display product_thumbnail product_offer_thumb*} {foreach from=$row item=product name=products} {if $product} <td{interline name=products additional_class="product-cell"}> <div class="image"> <a href="{$product.alt_url|default:$product.page_url| amp}">{include file="product_thumbnail.tpl" productid=$product.productid image_x=$product.tmbn_x image_y=$product.tmbn_y product=$product.product tmbn_url=$product.tmbn_url}</a> </div> </td> {/if} {/foreach} </tr> {*Display product code*} {if $config.Appearance.display_productcode_in_list eq "Y"} <tr{interline name=products_matrix}> {foreach from=$row item=product name=products} {if $product} <td{interline name=products additional_class="product-cell"}> {if $product.productcode} <div class="sku"><a href="{$url}">{$product.productcode|escape}</a></div> {else} {/if} </td> {/if} {/foreach} </tr> {/if} {if not $smarty.foreach.products_matrix.last} <tr class="separator"> <td colspan="{$config.Appearance.products_per_row|defa ult:1}"> </td> </tr> {/if} {/foreach} </table> {/if} When I remove the include products_t.tpl, my design goes back to normal. So, it's something within this file causing the issue, I believe. Link to my site is here; http://5dollarinkcartridges.com.au/newsite/manufacturers.php?manufacturerid=3 |
Re: help with products_list.tpl problem, repeating product?
Never mind! I got it. Had a table over a table tag. lol Thanks for the help, do0d!!!!! You rock!!!!!!!!
|
Re: help with products_list.tpl problem, repeating product?
You're very welcome. Whew! I'm glad we got through it. :-)
Hit those thanks buttons, I'm playing this like a video game and that's my score.... Where are you from? I'm in Louisville, KY USA |
Re: help with products_list.tpl problem, repeating product?
Is there anyway possible to customize http://5dollarinkcartridges.com.au/newsite/home.php?cat=4 , and change that back to the way it was, but KEEP all my other changes?
|
Re: help with products_list.tpl problem, repeating product?
Sure see this post where I talk about duplicating products_t.tpl.
http://forum.x-cart.com/showpost.php?p=325238&postcount=19 |
Re: help with products_list.tpl problem, repeating product?
Thanks for your help, so much. I clicked Thanks on here. You gave the best advice anyone could have gave. I thank you so much! Have a good day tomorrow, good sir!
|
All times are GMT -8. The time now is 10:14 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.