Esempio n. 1
0
 /**
  * Get the Products contained in the given Pack.
  *
  * @param \Pack $pack
  * @param integer $id_lang Optional
  * @return Array[Product] The products contained in this Pack, with special dynamic attributes [pack_quantity, id_pack_product_attribute]
  */
 public function getPackItems($pack, $id_lang = false)
 {
     if ($id_lang === false) {
         $configuration = \PrestaShop\PrestaShop\Adapter\ServiceLocator::get('\\PrestaShop\\PrestaShop\\Core\\ConfigurationInterface');
         $id_lang = (int) $configuration->get('PS_LANG_DEFAULT');
     }
     return \PackCore::getItems($pack->id, $id_lang);
 }
Esempio n. 2
0
 /**
  * Get product pack items
  *
  * @param int $id_product
  * @param int $id_lang
  */
 public function getItems($id_product, $id_lang)
 {
     $packItems = \PackCore::getItems($id_product, $id_lang);
     foreach ($packItems as $k => $packItem) {
         $cover = $packItem->id_pack_product_attribute ? \Product::getCombinationImageById($packItem->id_pack_product_attribute, $id_lang) : \Product::getCover($packItem->id);
         $packItem->image = \Context::getContext()->link->getImageLink($packItem->link_rewrite, $cover ? $cover['id_image'] : '', 'home_default');
     }
     return $packItems;
 }