public function addAction() { Mage::log('debug : *** addAction'); $_product = $this->processProduct(); $cart = $this->_getCart(); $tokens = SpectrumProductProcessor::getImageProcessingType($_product); if (count($tokens) > 0) { foreach ($tokens as $token) { Mage::log('processing token = ' . $token); if ($token != "" && $token != "None" && $token != "none") { SpectrumProductProcessor::addProcessingProductToCart($token, $cart); $this->_getSession()->addSuccess($token . " was added to your shopping cart."); } else { Mage::log("SKU : " . $_product->getSku() . " requires no image processing"); } } } else { Mage::log("SKU : " . $_product->getSku() . " requires no image processing"); } $cart = $this->_getCart(); if ($this->processRedrawingOption($_product)) { Mage::log("REDRAWING REQUIRED"); $id = Mage::getModel('catalog/product')->getIdBySku("artwork-redrawing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); $message = $this->__('Artwork redrawing fee was added to your shopping cart.'); $this->_getSession()->addSuccess($message); } else { Mage::log("Unable to locate artwork redrawing fee product"); } } if ($this->processOption($_product, "Rush Order Surcharge (If order is required in less than 10 days please apply.)", "Yes Please")) { Mage::log("RUSH ORDER SURCHARGE REQUIRED"); $id = Mage::getModel('catalog/product')->getIdBySku("rush-order-surcharge"); if ($id) { $cart->addProductsByIDs(array($id)); $message = $this->__('Rush order surcharge fee was added to your shopping cart.'); $this->_getSession()->addSuccess($message); } else { Mage::log("Unable to locate rush order surcharge product"); } } if ($this->processOption($_product, "2nd Poll Printing", "Yes Please")) { Mage::log("2nd poll printing REQUIRED"); $id = Mage::getModel('catalog/product')->getIdBySku("2nd-poll-printing-surcharge"); if ($id) { $cart->addProductsByIDs(array($id)); $message = $this->__('2nd poll printing fee was added to your shopping cart.'); $this->_getSession()->addSuccess($message); } else { Mage::log("Unable to locate 2nd poll printing surcharge product"); } } $cart->removeItem($_product->getId())->save(); parent::addAction(); }
public static function addProcessingProductToCart($value, $cart) { $store = SpectrumProductProcessor::getStoreType(); Mage::log('debug : *** addProcessingProductToCart :' . $value . " in the :" . $store . " store"); if ($value == 'Colour Printing Origination Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("colour-printing-origination-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Artwork Redrawing Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("artwork-redrawing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Pewter Tooling') { $id = Mage::getModel('catalog/product')->getIdBySku("pewter-tooling-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Foil Block Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("foil-block-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Stitching Origination Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("stitching-origination-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Silk Screen Printing Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("silk-screen-printing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Card Header Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("card-header-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Tin and Tee Printing Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("tin-and-tee-printing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == 'Hand Painting Fee') { $id = Mage::getModel('catalog/product')->getIdBySku("hand-painting-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == '1 Side Bag Tag Printing') { $id = Mage::getModel('catalog/product')->getIdBySku("1-side-bag-tag-printing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { if ($value == '2 Sided Bag Tag Printing') { $id = Mage::getModel('catalog/product')->getIdBySku("2-side-bag-tag-printing-fee"); if ($id) { $cart->addProductsByIDs(array($id)); } } else { Mage::log('unknown image processing type ' . $value); } } } } } } } } } } } }