Adding Product_Code Next To Variant_Name

Ηι,



This is is a pretty simple thing to do but I'm a bit stuck and I'm sure someone with a little better PHP knowledge from me could do it in a few seconds.



Combinations are already activated and are being tracked in inventory.



I'm using cs-cart 4.01



At the [font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]Template[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]/[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]Views[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]/[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]products[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]/[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]components[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]/[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]product[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]_[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]options[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2].[/size][/font][/color][/color][/size][/font][font=“Arial”][size=“2”][color=“navy”][color=navy][font=Arial][size=2]tpl [/size][/font][/color][/color][/size][/font]file I'm trying to call the product_code field from the table cscart_product_options_inventory right after {$vr.variant_name}, I guess it needs something like {$po.product_code} or along those line, but I don;t know the array

Hello Iedm,



In order to know the array use {$vr|fn_print_r}.



Sincerely yours,

CS-Market.

[quote name='CS-Market' timestamp='1401691345' post='184811']

Hello Iedm,



In order to know the array use {$vr|fn_print_r}.



Sincerely yours,

CS-Market.

[/quote]



Unfortunanetly neither the $po array or the $vr array contains the info that I want. As i mentioned on my initial post the info that I want is located at the cscart_product_options_inventory table

[quote name='ledm' timestamp='1401354899' post='184525']

Ηι,



This is is a pretty simple thing to do but I'm a bit stuck and I'm sure someone with a little better PHP knowledge from me could do it in a few seconds.



Combinations are already activated and are being tracked in inventory.



I'm using cs-cart 4.01



At the [font=“Arial”][size=“2”][color=navy][font=Arial][size=2]Template[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]/[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]Views[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]/[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]products[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]/[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]components[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]/[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]product[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]_[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]options[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2].[/size][/font][/color][/size][/font][font=“Arial”][size=“2”][color=navy][font=Arial][size=2]tpl [/size][/font][/color][/size][/font]file I'm trying to call the product_code field from the table cscart_product_options_inventory right after {$vr.variant_name}, I guess it needs something like {$po.product_code} or along those line, but I don;t know the array

[/quote]



You cannot specify Product code for each option variant, but for the options combination. It looks like additional code modifications are required and there is no simple solution.

I found an unorthodox ways of doing this so I won't go into all the details since you may totally mess your system if you don't know that you are doing:


  1. @ the database: Inner joined the variants table and the inventory table and created a new column in the variants table called “product_code”


  2. Edited the function that creates the $product_options and $variants array so that it includes the product_code


  3. Now I can use {$vr.product_code} at any template file.



    the downside is that I have to to run the initial query when I add new products… but It's nothing important, I guess I could make it run automaticaly when a new product is added.



    You can check the result here (it is in Greek though)

    http://www.ledm.gr/led-el-3/category-285/led-cob-10w-clone-el.html