php - Issue Magento = insert elements and call function javascript -


if u see javascript don't edit because related magento. thank you!

i have called phtml script under price box in product view page validation function phtml :

<script type="text/javascript"> //<![cdata[      $$('#product-price-<?php echo mage::registry('current_product')->getid(); ?>').each (function(elem){         $(elem).hide();     });      $('product-price-<?php echo mage::registry('current_product')->getid(); ?>').show();     var cp = document.getelementbyid('product-price-<?php echo mage::registry('current_product')->getid(); ?>');      cp.innerhtml = '$&nbsp;<input type="text" class="input-text price" name="custom_price" style="width:auto;" value="<?php echo mage::registry('current_product')->getprice(); ?>" onchange="onchangecp(this);"/></span><input type="hidden" id="custom_price_total" name="custom_price_total" value="<?php echo mage::registry('current_product')->getprice(); ?>">';      <?php           $product = mage::getmodel('catalog/product')->load(mage::registry('current_product')->getid());          $allowcustomprice = $product->getattributetext('allow_customprice');         $minprice = $product->getminprice(); //getattributetext('min_price');     ?>      function changecustomprice(el){         adviceblock=$(el).up('span').down('.validation-advice');         if(el.value.replace(',','.')>=<?php echo $minprice; ?>){             if(adviceblock){                 adviceblock.remove();                 el.removeclassname('validation-failed');             }         }else{             if(!adviceblock){                 el.insert({after:'<div class="validation-advice">the price should equal or greater <?php echo $minprice; ?>.</div>'});                 el.addclassname('validation-failed');             }         }         optionsprice.productprice=el.value;         optionsprice.reload();     }     optionsprice.formatprice=function(price){         $('custom_price_total').value=price;         return formatcurrency(price,optionsprice.priceformat);     }; //]]> </script> 

this script hide span displays price draw input box price client enter price should greater mean price; if s less draw error.

when clicked in add cart button damn function doesn't execute , nothing done !

if method wrong how can hide span , add input in product view using magento (php/...)

i'm not sure issue function not running or addtocart fail. first, add cart button irrelevant price showing block. second, didn't bind event on add cart, click button not execute. last, maybe miss found price customer changed not affect price in magento. after these process price might show different user on product page, still show original price in cart.

you need modified price before product add cart php.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -