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)
-   -   cart_details.tpl -- can I insert a variant in cart display? (https://forum.x-cart.com/showthread.php?t=23640)

carpeperdiem 07-27-2006 06:25 PM

cart_details.tpl -- can I insert a variant in cart display?
 
Dear Brain Trust:

In /skin1/customer/main/cart_details.tpl (the page that has the final listing of items before checkout) -
immediately after {$products[prod_num].product|truncate:"40":"...":true}:
Code:

<A href="product.php?productid={$products[prod_num].productid}" title="{$products[prod_num].product|escape:"html"}{if $products[prod_num].product_options}:
{capture name=po}{include file="modules/Product_Options/display_options.tpl" options=$products[prod_num].product_options is_plain='Y'}{/capture}{$smarty.capture.po|escape}{/if}">
{* BEGIN COMMENT OUT SKU DISPLAY AT CHECKOUT *}
{* {if $products[prod_num].productcode}{$products[prod_num].productcode}{else}#{$products[prod_num].productid}{/if}. *}
{* END COMMENT OUT SKU DISPLAY AT CHECKOUT *}
{$products[prod_num].product|truncate:"40":"...":true}
</A></TD>

I want to insert the "variant" color option -- like this mockup:
[image removed]

I thought the code that I used on cart.tpl to display the color variant:
Code:

{if $products[product].product_options ne ""}
{include file="modules/Product_Options/display_options.tpl" options=$products[product].product_options} {/if}

Would work here -- but nothing displays. Yes, I put it in the same <td> as the product...

Anyone have an idea here? Doesn't everyone want to list the color variant of the item in their final shopping cart? has anyone done this?

Thanks,

Jeremy

geckoday 07-27-2006 07:57 PM

Look a few lines above where you want to insert the options to see how its done. The array index is [prod_num] instead of [product].

carpeperdiem 07-27-2006 08:18 PM

Quote:

Originally Posted by geckoday
The array index is [prod_num] instead of [product].

Ralph -- you're the best! Thanks again!
This is exactly what I was trying to do (and it really should be stock, don't you agree? What customer would not want to see the color and/or size variant of the item they are buying?

NOW -- can I ask HOW did you find out all the array index fields? Is there a master directory of what x-cart is keeping track of?

Can you point me somewhere so that I can learn more about what is under the hood?

Thanks for being here and contributing...

Jeremy

geckoday 07-28-2006 05:46 AM

Quote:

Originally Posted by carpeperdiem
This is exactly what I was trying to do (and it really should be stock, don't you agree? What customer would not want to see the color and/or size variant of the item they are buying?

Yes, it should be stock.

Quote:

NOW -- can I ask HOW did you find out all the array index fields?

In this case it was easy. You posted it in your original post. Look at the second, third and fourth lines of the original X-Cart code you posted. For some strange reason X-Cart puts the options in the link title but doesn't display them.

Quote:

Is there a master directory of what x-cart is keeping track of?

Can you point me somewhere so that I can learn more about what is under the hood?

There is no directory. But you can add this to the top of any template to see what variables are available:
Code:

{php}func_print_r($this->_tpl_vars);{/php}
I wish there was a good reference to what's under the hood but I don't know of any. Its usually a lot of grunt work chasing code to find out how something works and where to put changes.


All times are GMT -8. The time now is 08:39 PM.

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