X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Product SKU on search results (https://forum.x-cart.com/showthread.php?t=6069)

CenturyPerf 01-16-2004 05:00 PM

Product SKU on search results
 
I have about half of this working, but it is just not pulling the Product Code. I've used this elsewhere and it is working fine. Just not on the search results page.

Code:

Product SKU: {$product[product].productcode}

I've entered the above into */customer/main/products.tpl* and I know I'm missing something, I just don't know what it is.

I've entered as below:

Code:

{* $Id: products.tpl,v 1.36 2003/11/11 14:02:37 svowl Exp $ *}
{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}
{include file="customer/main/products_t.tpl" products=$products}
{else}
{if $products}
{section name=product loop=$products}
<table border=0 width=100%>
<tr><td width=90 align=center valign=top>
<a href=product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}>{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].tmbn_url}
{$lng.lbl_see_details}</a>
</td>
<td valign=top>
{$products[product].product}</font>
<font size=1>


Product SKU: [b]{$product[product].productcode}</b




{$products[product].descr|truncate:300:"...":true}


</font>


Can someone advise me as to what I'm missing here?

leon 01-16-2004 08:33 PM

If that is the EXACT code you are using, you are missing an "s"

Product SKU: [b]{$product(HERE)[product].productcode}

CenturyPerf 01-16-2004 09:57 PM

Adding an "s" makes no difference at all. :(

I have used that exact code
Code:

Product SKU: {$product[product].productcode}
in other places in the site. I personally have no use at all for the "productid" field, though I know X-Cart must have it. I cannot remember the corellation between 100,000 product ID's and their actual SKUs, but I can remember the SKUs. :wink:

I have so far been able to get rid of the "productid" and change it to the SKU in: Modify Products and other areas.

Anyone with another suggestion?

leon 01-16-2004 10:17 PM

Did you actually try it ? You see, the $products variable is being parsed from the php script itself, which outputs to smarty, there is no way the script will recognize an unpassed variable.

See it for yourself in /customer/products.php at the end of the script:
Code:

$smarty->assign("products",$products);

If it has been usefull in other parts, it is only because those other parts use a different variable assignation scheme (even if similar, but not the same, since 1 character makes a worlds difference).

Oh, and also close your bold tag properly, this could lead to other output damage on the design side. :wink:

CenturyPerf 01-16-2004 11:42 PM

This is where it does NOT work: (you will see text above the thumbnail, but no product sku)
http://216.82.68.68/shop/customer/search.php?substring=

This is where it does work:
http://216.82.68.68/shop/customer/product.php?productid=16143&cat=0&page=1

In the example that works, I'm using:

Code:

Product SKU: {$product.productcode}

I've tried everything else I know of (and I'm just staring to learn PHP and Smarty) including:
  • Product SKU: {$products.productcode}
    Product SKU: {$product[product].productcode}
    Product SKU: {$products[product].productcode}

I also have it working (same as above) in place of ProductID on the Modify Products page in the admin section. You would think that if it works in 2 out of 3 spots, it should somehow work in the 3rd.
I'm sure this has to be something very simple

leon 01-17-2004 12:04 AM

Now I get the picture, should of seen your site earlier.

Guess what, you are editing the wrong file. It shows ok for your product details (products.tpl) but not your listed products.

Products are listed by category as well as search results with this file:
products_t.tpl

CenturyPerf 01-17-2004 12:23 AM

Editing that file has made no difference. I've tried entering the code and it never shows up on the search results page. Are you sure you're looking at the correct link I gave in the previous post?

leon 01-17-2004 01:03 AM

Sorry, you're right, it is in products.tpl, but the code is:
Code:

{$products[product].productcode}
(notice the "s" as mentioned previously)

But I dont know why it wouldnt show. Im new to smarty as well, although I cannot find any logical reason for it not to show if you have entered it like that.

Im going to have a look at the php scripts as well, maybe its a query at the search engine that doesnt look for the productcode by default.

Note: just for the heck of it, could you try as above (without the product sku initial note and bold tags ?

leon 01-17-2004 01:36 AM

Just verified it on my own site, works without any problem and just the way I mentioned on my first post, I really dont know what you are doing wrong, this is the code Im using:

Code:

<font size=1>


Product SKU: {$products[product].productcode}


{$products[product].descr|truncate:300:"...":true}


</font>


CenturyPerf 01-17-2004 10:03 AM

Maybe I just have some "cache bugs" or something. I tried it this morning the same way I did last night ... now it works. :?: :roll: :oops:

I'm happy it is working, but curious as to why it decided not to work last night.

Thanks for the help Leon!


All times are GMT -8. The time now is 03:20 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.