views:

199

answers:

1

Hi,

I am trying to replace my magento super attributes table with a drop down menu in place of it, Ive got the menu created but I am struggling to get it to actually use the data from the select dropdown. On submit it calls up function productAddToCartForm, which I feel like if I could modify, I could figure it out. But I have no idea where that function is. My php code looks like the following.

<?php if (count($_associatedProducts)): ?>
<select name="selectedSku">
<?php foreach ($_associatedProducts as $_item): ?>
<?php
$prodname = $this->htmlEscape($_item->getName());
$prodprice = $this->htmlEscape($_item->getPrice());
$prodcolor = $_item->getFullColor();
$prodsize = $_item->getTopSize();
$prodcombined = $prodname;
$prodcombined .= " / ";
$prodcombined .= $prodprice;
echo "<option ";
echo "value ='";
echo $_item->getId();
echo "'>";
echo $prodcombined;
echo "</option>";
?>
<?php endforeach; ?>
</select>

Any help would be much appreciated. Thanks!

A: 

That productAddToCartForm javascript method is found in app/design/frontend/default/default/template/catalog/product/view.phtml. Really all it does is create a VarienForm object (which is in js/varien/form.js), and then it validates and submits the form.

I suggest you find the URL that the form submits to and then check out a tutorial on how to find the code. This nice tutorial by Alan Storm might be a good start for you to understand how a magento URL maps to the code: http://alanstorm.com/magento_controller_hello_world. Also, this "How to overload a controller" might be helpful? http://www.magentocommerce.com/wiki/how_to_overload_a_controller

In any case, good luck.

sdek