Example #1
0
 /**
  * Callback for add_to_cart button
  *
  * @param IsotopeProduct $objProduct
  * @param array          $arrConfig
  */
 public function addToCart(IsotopeProduct $objProduct, array $arrConfig = array())
 {
     $objModule = $arrConfig['module'];
     $intQuantity = $objModule->iso_use_quantity && intval(\Input::post('quantity_requested')) > 0 ? intval(\Input::post('quantity_requested')) : 1;
     // Do not add parent of variant product to the cart
     if ($objProduct->hasVariants() && !$objProduct->isVariant()) {
         return;
     }
     if (Isotope::getCart()->addProduct($objProduct, $intQuantity, $arrConfig) !== false) {
         Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['addedToCart']);
         if (!$objModule->iso_addProductJumpTo) {
             $this->reload();
         }
         \Controller::redirect(\Haste\Util\Url::addQueryString('continue=' . base64_encode(\Environment::get('request')), $objModule->iso_addProductJumpTo));
     }
 }