Пример #1
0
 private function generateTag()
 {
     $product = new Product((int) Tools::getValue('id_product'), true, (int) $this->context->language->id);
     if ($product_sku = PowaTagProductHelper::getProductSKU($product)) {
         $lang = Configuration::get('POWATAG_LANG');
         if ($lang == "site") {
             // convert "en-us" to "en_US"
             $lang = $this->context->language->language_code;
             $lang = str_replace("-", "_", $lang);
             $alang = explode("_", $lang);
             if (count($alang) == 2) {
                 $lang = strtolower($alang[0]) . "_" . strtoupper($alang[1]);
             }
         }
         $datas = array('powatagApi' => Configuration::get('POWATAG_API_KEY'), 'productSku' => PowaTagProductHelper::getProductSKU($product), 'powatagGeneratorURL' => Configuration::get('POWATAG_GENERATOR_URL'), 'powatagRedirect' => Configuration::get('POWATAG_REDIRECT'), 'powatagOffer' => Configuration::get('POWATAG_OFFER'), 'powatagLang' => $lang, 'powatagType' => Configuration::get('POWATAG_TYPE'), 'powatagStyle' => Configuration::get('POWATAG_STYLE'), 'powatagColorscheme' => Configuration::get('POWATAG_COLORSCHEME'), 'powatagDisplay' => Configuration::get('POWATAG_DISPLAY'), 'powatagVideo' => Configuration::get('POWATAG_VIDEO') ? "true" : "false", 'powatagDebug' => Configuration::get('POWATAG_DEBUG') ? "true" : "false");
         $this->context->smarty->assign($datas);
         return $this->display(__FILE__, 'product.tpl');
     }
 }
Пример #2
0
 private function getVariants()
 {
     $groups = array();
     if ($this->combinations && count($this->combinations)) {
         foreach ($this->combinations as $combination) {
             if (!array_key_exists($combination['id_product_attribute'], $groups)) {
                 $groups[$combination['id_product_attribute']] = array('code' => PowatagProductAttributeHelper::getVariantCode($combination), 'numberInStock' => PowaTagProductQuantityHelper::getCombinationQuantity($combination), 'productImages' => $this->getCombinationImages($combination['id_product_attribute']), 'originalPrice' => array('amount' => $this->formatNumber($this->product->getPrice($this->display_taxes, null), 2), 'currency' => $this->context->currency->iso_code), 'finalPrice' => array('amount' => $this->formatNumber($this->product->getPrice($this->display_taxes, $combination['id_product_attribute']), 2), 'currency' => $this->context->currency->iso_code));
             }
             $groups[$combination['id_product_attribute']]['options'][$combination['group_name']] = $combination['attribute_name'];
         }
         sort($groups);
     } else {
         $variant = array('code' => PowaTagProductHelper::getProductSKU($this->product), 'numberInStock' => PowaTagProductQuantityHelper::getProductQuantity($this->product), 'finalPrice' => array('amount' => $this->formatNumber($this->product->getPrice($this->display_taxes, null), 2), 'currency' => $this->context->currency->iso_code));
         $groups = array($variant);
     }
     return $groups;
 }