To Show Custom Option , configuration option , quantity in list page.
Put the code in place of where add to cart is now:
<?php echo $this->helper(‘checkout’)->formatPrice($_product->getFinalPrice()) ?>
<form action=”<?php echo Mage::getBaseUrl(); ?>checkout/cart/add/” method=”post” style=”display:block; clear:both;”>
<?php
$product = Mage::getModel(‘catalog/product’);
$product->load($_product->getId());
//print_r($product);
//exit();
$xml = “”;
$hasAtts = 0;
// configurable products
$productType = $product->getTypeId();
if($productType == “configurable”) {
// configurable products
$attValConfig = $product->getTypeInstance()->getConfigurableAttributesAsArray();
if(sizeof($attValConfig)) {
$hasAtts++;
foreach($attValConfig as $attValConfigSingle) {
$xml .= “<div class=’floatoption1′>”.$attValConfigSingle[‘frontend_label’].”: “;
$xml .= “<select style=’display:block; clear:both; margin-bottom:10px;’ name=’super_attribute[“.$attValConfigSingle[‘attribute_id’].”]’><option selected=’selected’>Choose an option</option>”;
foreach($attValConfigSingle[‘values’] as $attValConfigSingleVal) {
$baseprice = $this->getPriceHtml($product, true);
$strippedprice = str_replace(“£”, “”, $baseprice);
$numprice = strip_tags($strippedprice);
$numpricea = (float)$numprice;
$optionprice = $attValConfigSingleVal[‘pricing_value’];
$numpriceb = (float)$optionprice;
$catprice = $numpricea + $numpriceb;
$catpricea = number_format($catprice,2);
if (is_numeric($numpriceb)) {
$xml .= “<option value='”.$attValConfigSingleVal[‘value_index’].”‘>”.$attValConfigSingleVal[‘label’].” £”.$catpricea.”</option>”;
} else { $xml .= “<option value='”.$attValConfigSingleVal[‘value_index’].”‘>Not Mumeric</option>”; }
}
$xml .= “</select></div>”;
}
}
}
// end configurable products
$attVal = $product->getOptions();
if(sizeof($attVal)) {
$hasAtts++;
foreach($attVal as $optionVal) {
$xml .= “<div class=’floatoption1′>Size:<select style=’display:block; clear:both; margin-bottom:10px;’ name=’options[“.$optionVal->getId().”]’><option selected=’selected’>Choose an option</option>”;
foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
$xml .= “<option value='”.$valuesVal->getId().”‘>”.$valuesVal->getTitle().” +”.Mage::helper(‘core’)->currency($valuesVal->getPrice()).”</option>”;
}
$xml .= “</select></div>”;
}
}
$xml .= “<div class=’floatoption2′>Qty: <input style=’display:block; clear:both; margin-bottom:20px;’ id=’qty’ class=’input-text qty’ type=’text’ value=’1′ maxlength=’12’ name=’qty’/></div>”;
echo($xml);
?>
<input type=”hidden” name=”product” value=”<?php echo($_product->getId()); ?>” />
<div>
<button type=”submit”><span><span><?php echo $this->__(‘Add to Cart’) ?></span></span></button></div>
</form>
<script type=”text/javascript”>
var productAddToCartForm_<?php echo $_product->getId(); ?> = new VarienForm(‘product_addtocart_form_<?php echo $_product->getId(); ?>’);
productAddToCartForm_<?php echo $_product->getId(); ?>.submit = function(){
if (this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm_<?php echo $_product->getId(); ?>);
</script>