Author Topic: $product_name variable on addtocart_advanced_attribute.tpl.php  (Read 3199 times)

deggertsen

  • Beginner
  • *
  • Posts: 12
I'm trying to use the variable $product_name on the page addtocart_advanced_attribute.tpl.php but it doesn't work.  I've tried several things to be able to use the variable but to no avail.  Sadly my lack of knowledge in php has limited me here.  Can anybody help?

deggertsen

  • Beginner
  • *
  • Posts: 12
Re: $product_name variable on addtocart_advanced_attribute.tpl.php
« Reply #1 on: August 01, 2008, 23:42:48 pm »
After many hours of study and trying to figure this out I came up with a solution.  I don't know if it is the best one but it worked!  Here's the code that I added just after "foreach($attributes as $attribute) {" at the beginning in the file addtocart_advanced_attribute.tpl.php

Code: [Select]
$query = "SELECT * FROM `jos_vm_product` WHERE `product_id`='".$attribute['product_id']."'";
   $rows = mysql_query($query) or  die(mysql_error());
   $product = mysql_fetch_array($rows);

This allowed me to call the Product Name in the attribute box as the variable "$product['product_name']".

I don't know if this will be useful to anyone else as it's not a common need but there it is just in case!