/** * Retrieve block javascript * * @return string */ public function getJs() { return parent::getJs() . "\n function confirmRemoveWishlistItem() {\n return confirm('" . $this->__('Are you sure you want to remove this product from your wishlist?') . "');\n }\n "; }
/** * Retrieve column related javascript code * * @return string */ public function getJs() { $js = "\n function addWItemToCart(itemId) {\n var url = '" . $this->getItemAddToCartUrl('%item%') . "';\n url = url.gsub('%item%', itemId);\n var form = \$('wishlist-view-form');\n if (form) {\n var input = form['qty[' + itemId + ']'];\n if (input) {\n var separator = (url.indexOf('?') >= 0) ? '&' : '?';\n url += separator + input.name + '=' + encodeURIComponent(input.value);\n }\n }\n setLocation(url);\n }\n "; $js .= parent::getJs(); return $js; }
/** * Retrieve block javascript * * @return string */ public function getJs() { return parent::getJs() . "\n function confirmRemoveWishlistItem() {\n return confirm('" . Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you want to remove this product from your wishlist?')) . "');\n }\n "; }
public function testGetJs() { $expected = uniqid(); $this->_layout->getBlock('child')->setJs($expected); $this->assertEquals($expected, $this->_block->getJs()); }
/** * Retrieve column javascript code * * @return string */ public function getJs() { return parent::getJs() . "\n function focusComment(obj) {\n if( obj.value == '" . $this->helper('Mage_Wishlist_Helper_Data')->defaultCommentString() . "' ) {\n obj.value = '';\n } else if( obj.value == '' ) {\n obj.value = '" . $this->helper('Mage_Wishlist_Helper_Data')->defaultCommentString() . "';\n }\n }\n "; }
/** * Get block javascript * * @return string */ public function getJs() { return parent::getJs() . "\n var selector = \$('select-all'),\n checkboxes = \$(selector).up('#wishlist-table').select('.select'),\n counter = 0;\n if (!checkboxes.length) {\n selector.hide();\n }\n selector.setCounter = function (newVal) {\n counter = newVal;\n this.checked = (counter >= checkboxes.length);\n }\n selector.onclick = function(){\n checkboxes.each( (function(checkbox) {\n checkbox.checked = this.checked;\n }).bind(this));\n counter = this.checked ? checkboxes.length : 0\n };\n checkboxes.each( function(checkbox) {\n checkbox.onclick = function() {\n selector.setCounter(this.checked ? counter + 1: counter -1);\n }\n });\n "; }
/** * Retrieve column javascript code * * @return string */ public function getJs() { return parent::getJs() . "\r\n function focusComment(obj) {\r\n if( obj.value == '" . $this->helper('wishlist')->defaultCommentString() . "' ) {\r\n obj.value = '';\r\n } else if( obj.value == '' ) {\r\n obj.value = '" . $this->helper('wishlist')->defaultCommentString() . "';\r\n }\r\n }\r\n "; }