$this->_getHelperInstance('core') ->urlEncode($this->getCurrentUrl()), 'product' => $product->getEntityId(), Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey() ); if (!empty($additional)) { $routeParams = array_merge($routeParams, $additional); } if ($product->hasUrlDataObject()) { $routeParams['_store'] = $product->getUrlDataObject()->getStoreId(); $routeParams['_store_to_url'] = true; } if ($this->_getRequest()->getRouteName() == 'mediaupdate' && $this->_getRequest()->getControllerName() == 'cart') { $routeParams['in_cart'] = 1; } //only this row below is changed return $this->_getUrl('mediaupdate/cart/add', $routeParams); } /** * Check if product can be sold * @param Mage_Catalog_Model_Product $product * @return bool */ public function productIsAvailableForSale($product) { $_product = Mage::getModel('catalog/product')->load($product->getId()); $inStock = $_product->getStockItem()->getIsInStock(); if ($inStock && $_product->isSalable()) { return true; } return false; } /** * Define label color depending on the background * example of $hexcolor: 454829 //without # */ public function defineLabelColor($hexcolor) { $r = hexdec(substr($hexcolor,0,2)); $g = hexdec(substr($hexcolor,2,2)); $b = hexdec(substr($hexcolor,4,2)); $yiq = (($r*299)+($g*587)+($b*114))/1000; return ($yiq >= 128) ? '#000000' : '#FFFFFF'; } }