<?php if ($data['gravity_form_id'] && CART66_PRO && $data['showPrice'] != 'only') { ?> <?php if (!$data['product']->isInventoryTracked($data['product']->getInventoryKey())) { ?> <?php echo do_shortcode("[gravityform id=" . $data['gravity_form_id'] . " ajax=false] "); ?> <?php } else { ?> <?php if (Cart66Product::checkInventoryLevelForProduct($data['product']->id) == 0) { $soldOutLabel = Cart66Setting::getValue('label_out_of_stock') ? strtolower(Cart66Setting::getValue('label_out_of_stock')) : __('out of stock', 'cart66'); ?> <div class="alert-message alert-error Cart66Unavailable"> We're sorry but <?php echo Cart66GravityReader::getFormTitle($data['gravity_form_id']); ?> is currently <?php echo $soldOutLabel; ?> . </div> <?php }
protected function _updateQuantitiesFromPost() { $qtys = Cart66Common::postVal('quantity'); if (is_array($qtys)) { foreach ($qtys as $itemIndex => $qty) { $item = $this->getItem($itemIndex); if (!is_null($item) && is_object($item) && get_class($item) == 'Cart66CartItem') { if ($qty == 0) { Cart66Common::log('[' . basename(__FILE__) . ' - line ' . __LINE__ . "] Customer specified quantity of 0 - remove item."); $this->removeItem($itemIndex); } if (Cart66Product::confirmInventory($item->getProductId(), $item->getOptionInfo(), $qty)) { $this->setItemQuantity($itemIndex, $qty); } else { $qtyAvailable = Cart66Product::checkInventoryLevelForProduct($item->getProductId(), $item->getOptionInfo()); $this->setItemQuantity($itemIndex, $qtyAvailable); if (!Cart66Session::get('Cart66InventoryWarning')) { Cart66Session::set('Cart66InventoryWarning', ''); } $inventoryWarning = Cart66Session::get('Cart66InventoryWarning'); $inventoryWarning .= '<div class="alert-message alert-error Cart66Unavailable">' . __("The quantity for", "cart66") . ' ' . $item->getFullDisplayName() . " " . __("could not be changed to", "cart66") . " {$qty} " . __("because we only have", "cart66") . " {$qtyAvailable} " . __("in stock", "cart66") . ".</div>"; Cart66Session::set('Cart66InventoryWarning', $inventoryWarning); Cart66Common::log("Quantity available ({$qtyAvailable}) cannot meet desired quantity ({$qty}) for product id: " . $item->getProductId()); } } } } }