isAvailableWhenOutOfStock((int) $item->out_of_stock) AND (floor( (int) $item->quantity / (int) $item->pack_quantity) < $pack_quantity)) { $pack_quantity = floor( (int) $item->quantity / (int) $item->pack_quantity); } } return $pack_quantity; } /** * Get simple pack */ public static function getSimplePack($id_product_pack){ if (isset($_cache_getSimplePack[(int) $id_product_pack])) { return $_cache_getSimplePack[(int) $id_product_pack]; } $_cache_getSimplePack[(int) $id_product_pack] = Db::getInstance()->executeS(' SELECT * FROM `' . _DB_PREFIX_ . 'pack` WHERE `id_product_pack` = ' . (int) $id_product_pack . ' '); return $_cache_getSimplePack[(int) $id_product_pack]; } /** * Get complete simple pack */ public static function getCompleteSimplePack($id_product_pack){ if (isset($_cache_getSimplePack[(int) $id_product_pack])) { return $_cache_getSimplePack[(int) $id_product_pack]; } $_cache_getSimplePack[(int) $id_product_pack] = Db::getInstance()->executeS(' SELECT pp.`id_product_pack`, pp.`quantity` AS `pack_quantity`, p.*, pl.* FROM `'._DB_PREFIX_.'pack` pp LEFT JOIN `'._DB_PREFIX_.'product` p ON (pp.`id_product_item` = p.`id_product`) LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON ( p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).' ) WHERE pp.`id_product_pack` = ' . (int) $id_product_pack . ' '); return $_cache_getSimplePack[(int) $id_product_pack]; } /** * Get item pack */ public static function getPacks($id_product_item){ return Db::getInstance()->executeS(' SELECT `id_product_pack`, `quantity` FROM `' . _DB_PREFIX_ . 'pack` WHERE `id_product_item` = ' . (int) $id_product_item . ' '); } }