当前位置: 首页>>代码示例>>PHP>>正文


PHP Link::getProductLink方法代码示例

本文整理汇总了PHP中Link::getProductLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Link::getProductLink方法的具体用法?PHP Link::getProductLink怎么用?PHP Link::getProductLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Link的用法示例。


在下文中一共展示了Link::getProductLink方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initContent

 public function initContent()
 {
     parent::initContent();
     $id = $_GET['id'];
     $id_lang = $this->context->language->id;
     $product = new Product((int) $id);
     $link = new Link();
     $url = $link->getProductLink($product);
     $features = Db::getInstance()->ExecuteS('
 		SELECT fl.name feature_name, fvl.value feature_value
 		FROM ' . _DB_PREFIX_ . 'feature_product fp
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_lang fl ON (fl.id_feature = fp.id_feature AND fl.id_lang=' . $id_lang . ' )
 		LEFT JOIN ' . _DB_PREFIX_ . 'feature_value_lang fvl ON (fvl.id_feature_value = fp.id_feature_value AND fvl.id_lang=' . $id_lang . ')
 		WHERE fp.id_product=' . $id);
     //	print_r($features);
     $images = Image::getImages((int) $id_lang, (int) $product->id);
     //Limitamos el numero de fotos a cuatro solamente
     while (count($images) > 3) {
         $var = array_pop($images);
     }
     $this->context->smarty->assign(array('product' => $product, 'lang' => $id_lang, 'image' => $images, 'dir' => Tools::getHttpHost(true) . __PS_BASE_URI__ . 'modules/pdfproduct', 'email' => Configuration::get('PS_SHOP_EMAIL'), 'url' => $url, 'address' => Configuration::get('ADDRESS_SHOP'), 'background' => Configuration::get('BACKGROUND')));
     $html = $this->context->smarty->fetch(_PS_MODULE_DIR_ . 'pdfproduct/views/templates/front/custom_template_content.tpl');
     $dompdf = new DOMPDF();
     $dompdf->set_option('enable_remote', TRUE);
     $dompdf->load_html($html);
     $dompdf->set_paper('a4', 'portrait');
     $dompdf->render();
     $dompdf->stream('producto');
     //$this->setTemplate('custom_template_content.tpl');
     //file_put_contents($filename, $dompdf->output());
     //$pdf = new PDF($product, 'CustomPdf', Context::getContext()->smarty);
     //$img_file = Tools::getHttpHost(true).__PS_BASE_URI__. '/modules/pdfproduct/views/images/background.jpg';
     //$pdf->pdf_renderer->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     //$pdf->render();
 }
开发者ID:hesselek,项目名称:printed_module,代码行数:35,代码来源:controllerPdf.php

示例2: sendQuestion

 public function sendQuestion()
 {
     if (Tools::getValue('enviar_mensaje')) {
         $params = array();
         $params['nombre'] = pSQL(Tools::getValue('nombre', ''));
         $params['email'] = pSQL(Tools::getValue('email', ''));
         $params['ciudad'] = pSQL(Tools::getValue('ciudad', ''));
         $params['provincia'] = pSQL(Tools::getValue('provincia', ''));
         $params['consulta'] = pSQL(Tools::getValue('consulta', ''));
         $params['id_producto'] = (int) Tools::getValue('id_producto', 0);
         $params['date_add'] = date('Y-m-d H:i:s', strtotime('now'));
         $params['validado'] = 0;
         DB::getInstance()->insert('lgconsultas', $params);
         $id_consulta = Db::getInstance()->Insert_ID();
         if ($id_consulta) {
             $consulta = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'lgconsultas` WHERE id_consulta=' . (int) $id_consulta);
             $producto = Db::getInstance()->getValue('SELECT name FROM ' . _DB_PREFIX_ . 'product_lang WHERE id_product=' . (int) $consulta['id_producto'] . ' AND id_lang=' . (int) Configuration::get('PS_LANG_DEFAULT'));
             $enlace = new Link();
             $urlproducto = $enlace->getProductLink($consulta['id_producto']);
             $templateVars = array('id_consulta' => $id_consulta, '{consulta}' => pSQL($consulta['consulta']), '{nombre}' => pSQL($consulta['nombre']), '{email}' => pSQL($consulta['email']), '{provincia}' => pSQL($consulta['provincia']), '{ciudad}' => pSQL($consulta['ciudad']), '{producto}' => $producto, '{urlproducto}' => $urlproducto);
             if (!Mail::Send((int) Configuration::get('PS_LANG_DEFAULT'), 'consulta_enviada', $this->l('You have received a new question about a product'), $templateVars, Configuration::get('LG_CONSULTAS_EMAIL'), null, Configuration::get('LG_CONSULTAS_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, _PS_MODULE_DIR_ . 'lgconsultas/mails/')) {
                 $out = array('status' => 'nok', 'msg' => $this->l('An error occurred while sending your question'));
             } else {
                 $out = array('status' => 'ok', 'msg' => $this->l('Your question has been sent'));
             }
         } else {
             $out = array('status' => 'nok', 'msg' => $this->l('An error occurred while trying to add your question'));
         }
         echo Tools::jsonEncode($out);
         die;
     }
 }
开发者ID:acreno,项目名称:pm-ps,代码行数:32,代码来源:responses.php

示例3: _prepareHook

 protected function _prepareHook($params)
 {
     $languages = Language::getLanguages(true, $this->context->shop->id);
     if (!count($languages)) {
         return false;
     }
     $link = new Link();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         if (Dispatcher::getInstance()->getController() == 'product' && ($id_product = (int) Tools::getValue('id_product'))) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'category' && ($id_category = (int) Tools::getValue('id_category'))) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if (Dispatcher::getInstance()->getController() == 'cms' && (($id_cms = (int) Tools::getValue('id_cms')) || ($id_cms_category = (int) Tools::getValue('id_cms_category')))) {
             $rewrite_infos = isset($id_cms) && !isset($id_cms_category) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = isset($id_cms) && !isset($id_cms_category) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], null, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         $this->smarty->assign('lang_rewrite_urls', $default_rewrite);
     }
     return true;
 }
开发者ID:jpodracky,项目名称:dogs,代码行数:32,代码来源:blocklanguages.php

示例4: ajaxProcessGetTable

 public function ajaxProcessGetTable()
 {
     $this->ormprod = new egormprod();
     $list = $this->ormprod->getProductList(0, false, false);
     $link = new Link();
     $output = "";
     foreach ($list as $row) {
         $output .= "<tr><td>-</td>";
         $output .= "<td>" . $row['id_product'] . "</td>";
         $output .= "<td><span>" . $row['product_sname'] . "</span><br><span style='font-size: 8px;'><a href='" . $row['product_url'] . "'>" . $row['product_url'] . "</a></span></td>";
         $output .= "<td><span>" . $row['name'] . "</span><br><span style='font-size: 8px;'><a href='" . $link->getProductLink($row['id_product']) . "'>" . $link->getProductLink($row['id_product']) . "</a></span></td>";
         $output .= "<td>" . $row['product_attrgroup'] . "</td>";
         $output .= "<td>" . $row['price_discount'] . "</td>";
         $output .= "<td>" . $row['dname'] . "</td>";
         $output .= "<td><a href='#' onclick='UpdateRow(this);return(false);'>R</a>";
         $output .= " <a href='" . Context::getContext()->link->getAdminLink('AdminProducts') . "&updateproduct&id_product=" . (int) $row['id_product'] . "' target='new'>E</a>";
         $output .= " <a href='#' onclick='InsertRow(this);return(false);'>I</a></td>";
         $output .= "</tr>";
     }
     die($output);
 }
开发者ID:evgrishin,项目名称:egcallme,代码行数:21,代码来源:AdminEGCallBackController.php

示例5: sendCampaign

    public function sendCampaign()
    {
        // get abandoned cart :
        $sql = "SELECT * FROM (\n\t\tSELECT\n\t\tCONCAT(LEFT(c.`firstname`, 1), '. ', c.`lastname`) `customer`, a.id_cart total, ca.name carrier, c.id_customer, a.id_cart, a.date_upd,a.date_add,\n\t\t\t\tIF (IFNULL(o.id_order, 'Non ordered') = 'Non ordered', IF(TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', a.`date_add`)) > 86400, 'Abandoned cart', 'Non ordered'), o.id_order) id_order, IF(o.id_order, 1, 0) badge_success, IF(o.id_order, 0, 1) badge_danger, IF(co.id_guest, 1, 0) id_guest\n\t\tFROM `" . _DB_PREFIX_ . "cart` a  \n\t\t\t\tJOIN `" . _DB_PREFIX_ . "customer` c ON (c.id_customer = a.id_customer)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "currency` cu ON (cu.id_currency = a.id_currency)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "carrier` ca ON (ca.id_carrier = a.id_carrier)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "orders` o ON (o.id_cart = a.id_cart)\n\t\t\t\tLEFT JOIN `" . _DB_PREFIX_ . "connections` co ON (a.id_guest = co.id_guest AND TIME_TO_SEC(TIMEDIFF('" . date('Y-m-d H:i:s') . "', co.`date_add`)) < 1800)\n\t\t) AS toto WHERE id_order='Abandoned cart'";
        $currency = Context::getContext()->currency->sign;
        $defaultLanguage = new Language((int) Configuration::get('PS_LANG_DEFAULT'));
        $abandoned_carts = Db::getInstance()->ExecuteS($sql);
        // get all available campaigns
        $sqlCampaigns = 'SELECT * FROM `' . _DB_PREFIX_ . 'campaign` WHERE active=1';
        $allCampaigns = Db::getInstance()->ExecuteS($sqlCampaigns);
        // loop on all abandoned carts
        foreach ($abandoned_carts as $abncart) {
            // loop on all available campaigns
            foreach ($allCampaigns as $camp) {
                $cartIsOnCampaign = $this->checkIfCartIsOnCampaign($abncart['date_add'], $camp['execution_time_day'], $camp['execution_time_hour']);
                if ($cartIsOnCampaign) {
                    $id_lang = (int) Configuration::get('PS_LANG_DEFAULT');
                    $customer = new Customer($abncart['id_customer']);
                    $cR = new CartRule($camp['id_voucher'], $id_lang);
                    $cart = new Cart($abncart['id_cart']);
                    $products = $cart->getProducts();
                    $campM = new Campaign($camp['id_campaign']);
                    if (!empty($products)) {
                        $cart_content = $campM->getCartContentHeader();
                    } else {
                        $cart_content = '';
                    }
                    foreach ($products as $prod) {
                        $p = new Product($prod['id_product'], true, $id_lang);
                        $price_no_tax = Product::getPriceStatic($p->id, false, null, 2, null, false, true, 1, false, null, $abncart['id_cart'], null, $null, true, true, null, false, false);
                        $total_no_tax = $prod['cart_quantity'] * $price_no_tax;
                        $images = Image::getImages((int) $id_lang, (int) $p->id);
                        $link = new Link();
                        $cart_content .= '<tr >
										<td align="center" ><img src="' . $link->getImageLink($p->link_rewrite, $images[0]['id_image']) . '" width="80"/></td>
										<td align="center" ><a href="' . $link->getProductLink($p) . '"/>' . $p->name . '</a></td>
										<td align="center" >' . Tools::displayprice($price_no_tax) . '</td>
										<td align="center" >' . $prod['cart_quantity'] . '</td>
										<td align="center" >' . Tools::displayprice($total_no_tax) . '</td>
									</tr>';
                    }
                    $tpl_vars = array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{coupon_name}' => $cR->name, '{coupon_code}' => $cR->code, '{cart_content}' => $cart_content, '{coupon_value}' => $camp['voucher_amount_type'] == 'percent' ? $cR->reduction_percent . '%' : $currency . $cR->reduction_amount, '{coupon_valid_to}' => date('d/m/Y', strtotime($cR->date_to)), '{campaign_name}' => $camp['name']);
                    $path = _PS_ROOT_DIR_ . '/modules/superabandonedcart/mails/';
                    // send email to customer :
                    Mail::Send($id_lang, $campM->getFileName(), $camp['name'], $tpl_vars, $customer->email, null, null, null, null, null, $path, false, Context::getContext()->shop->id);
                    // Email to admin :
                    Mail::Send($id_lang, $campM->getFileName(), Mail::l(sprintf('Email sent to %s %s for campaign %s', $customer->lastname, $customer->firstname, $camp['name'])), $tpl_vars, Configuration::get('PS_SHOP_EMAIL'), null, null, null, null, null, $path, false, Context::getContext()->shop->id);
                    //	echo 'ID ' . $abncart['id_cart'];
                }
            }
        }
    }
开发者ID:prestarocket,项目名称:superabandonedcart,代码行数:52,代码来源:launch_campaings.php

示例6: formatProduct

 protected function formatProduct($id_product, $id_lang)
 {
     $link = new Link();
     $product = new Product($id_product, true, $id_lang);
     $category = new Category($product->id_category_default, $id_lang);
     $product->objectID = $product->id;
     $product->category = $category->name;
     $product->url = $link->getProductLink($product->id);
     /* Cover */
     $cover = Image::getCover($product->id);
     $product->image_link_small = $link->getImageLink($product->link_rewrite, $cover['id_image'], ImageType::getFormatedName('small'));
     $product->image_link_large = $link->getImageLink($product->link_rewrite, $cover['id_image'], ImageType::getFormatedName('large'));
     return $product;
 }
开发者ID:matiasmenker,项目名称:algoliasearch-prestashop,代码行数:14,代码来源:AlgoliaSync.php

示例7: hookTop

 /**
  * Returns module content for header
  *
  * @param array $params Parameters
  * @return string Content
  */
 public function hookTop($params)
 {
     global $smarty;
     $languages = Language::getLanguages();
     if (!count($languages)) {
         return;
     }
     $link = new Link();
     if ((int) Configuration::get('PS_REWRITING_SETTINGS')) {
         $default_rewrite = array();
         $phpSelf = isset($_SERVER['PHP_SELF']) ? substr($_SERVER['PHP_SELF'], strlen(__PS_BASE_URI__)) : '';
         if ($phpSelf == 'product.php' and $id_product = (int) Tools::getValue('id_product')) {
             $rewrite_infos = Product::getUrlRewriteInformations((int) $id_product);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getProductLink((int) $id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int) $infos['id_lang']);
             }
         }
         if ($phpSelf == 'category.php' and $id_category = (int) Tools::getValue('id_category')) {
             $rewrite_infos = Category::getUrlRewriteInformations((int) $id_category);
             foreach ($rewrite_infos as $infos) {
                 $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int) $id_category, $infos['link_rewrite'], $infos['id_lang']);
             }
         }
         if ($phpSelf == 'cms.php' and ($id_cms = (int) Tools::getValue('id_cms') or $id_cms_category = (int) Tools::getValue('id_cms_category'))) {
             $rewrite_infos = (isset($id_cms) and !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category);
             foreach ($rewrite_infos as $infos) {
                 $arr_link = (isset($id_cms) and !isset($id_cms_category)) ? $link->getCMSLink($id_cms, $infos['link_rewrite'], NULL, $infos['id_lang']) : $link->getCMSCategoryLink($id_cms_category, $infos['link_rewrite'], $infos['id_lang']);
                 $default_rewrite[$infos['id_lang']] = $arr_link;
             }
         }
         if (count($default_rewrite)) {
             $smarty->assign('lang_rewrite_urls', $default_rewrite);
         }
     }
     $smarty->assign('languages', $languages);
     return $this->display(__FILE__, 'blocklanguages.tpl');
 }
开发者ID:Evil1991,项目名称:PrestaShop-1.4,代码行数:43,代码来源:blocklanguages.php

示例8: viewcustomer


//.........这里部分代码省略.........
					<th class="center">' . $this->l('Carrier') . '</th>
					<th class="center">' . $this->l('Actions') . '</th>
				</tr>';
            $tokenCarts = Tools::getAdminToken('AdminCarts' . (int) Tab::getIdFromClassName('AdminCarts') . (int) $cookie->id_employee);
            foreach ($carts as $cart) {
                $cartI = new Cart((int) $cart['id_cart']);
                $summary = $cartI->getSummaryDetails();
                $currency = new Currency((int) $cart['id_currency']);
                $carrier = new Carrier((int) $cart['id_carrier']);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '\'">
					<td class="center">' . sprintf('%06d', $cart['id_cart']) . '</td>
					<td>' . Tools::displayDate($cart['date_add'], (int) $cookie->id_lang, true) . '</td>
					<td align="right">' . Tools::displayPrice($summary['total_price'], $currency) . '</td>
					<td>' . $carrier->name . '</td>
					<td align="center"><a href="index.php?tab=AdminCarts&id_cart=' . $cart['id_cart'] . '&viewcart&token=' . $tokenCarts . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '
			</table>';
        } else {
            echo $this->l('No cart available') . '.';
        }
        echo '</div>';
        $interested = Db::getInstance()->ExecuteS('SELECT DISTINCT id_product FROM ' . _DB_PREFIX_ . 'cart_product cp INNER JOIN ' . _DB_PREFIX_ . 'cart c on c.id_cart = cp.id_cart WHERE c.id_customer = ' . (int) $customer->id . ' AND cp.id_product NOT IN (
		SELECT product_id FROM ' . _DB_PREFIX_ . 'orders o inner join ' . _DB_PREFIX_ . 'order_detail od ON o.id_order = od.id_order WHERE o.valid = 1 AND o.id_customer = ' . (int) $customer->id . ')');
        if (count($interested)) {
            echo '<div style="float:left;margin-left:20px">
			<h2>' . $this->l('Products') . ' (' . count($interested) . ')</h2>
			<table cellspacing="0" cellpadding="0" class="table">';
            foreach ($interested as $p) {
                $product = new Product((int) $p['id_product'], false, $cookie->id_lang);
                echo '
				<tr ' . ($irow++ % 2 ? 'class="alt_row"' : '') . ' style="cursor: pointer" onclick="document.location = \'' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '\'">
					<td>' . (int) $product->id . '</td>
					<td>' . Tools::htmlentitiesUTF8($product->name) . '</td>
					<td align="center"><a href="' . $link->getProductLink((int) $product->id, $product->link_rewrite, Category::getLinkRewrite($product->id_category_default, (int) $cookie->id_lang)) . '"><img src="../img/admin/details.gif" /></a></td>
				</tr>';
            }
            echo '</table></div>';
        }
        echo '<div class="clear">&nbsp;</div>';
        /* Last connections */
        $connections = $customer->getLastConnections();
        if (sizeof($connections)) {
            echo '<h2>' . $this->l('Last connections') . '</h2>
            <table cellspacing="0" cellpadding="0" class="table">
                <tr>
                    <th style="width: 200px">' . $this->l('Date') . '</th>
                    <th style="width: 100px">' . $this->l('Pages viewed') . '</th>
                    <th style="width: 100px">' . $this->l('Total time') . '</th>
                    <th style="width: 100px">' . $this->l('Origin') . '</th>
                    <th style="width: 100px">' . $this->l('IP Address') . '</th>
                </tr>';
            foreach ($connections as $connection) {
                echo '<tr>
                        <td>' . Tools::displayDate($connection['date_add'], (int) $cookie->id_lang, true) . '</td>
                        <td>' . (int) $connection['pages'] . '</td>
                        <td>' . $connection['time'] . '</td>
                        <td>' . ($connection['http_referer'] ? preg_replace('/^www./', '', parse_url($connection['http_referer'], PHP_URL_HOST)) : $this->l('Direct link')) . '</td>
                        <td>' . $connection['ipaddress'] . '</td>
                    </tr>';
            }
            echo '</table><div class="clear">&nbsp;</div>';
        }
        if (sizeof($referrers)) {
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:67,代码来源:AdminCustomers.php

示例9: getProductLink

 private function getProductLink($product_id, $link_rewrite = null)
 {
     global $link;
     if (isset($link) && method_exists($link, 'getProductLink')) {
         return $link->getProductLink((int) $product_id);
     } else {
         $link = new Link();
         return $link->getProductLink((int) $product_id);
     }
 }
开发者ID:juniorhq88,项目名称:PrestaShop-modules,代码行数:10,代码来源:yotpo.php

示例10: generateFlux

 public function generateFlux()
 {
     if (Tools::getValue('token') == '' || Tools::getValue('token') != Configuration::get('SHOPPING_FLUX_TOKEN')) {
         die('Invalid Token');
     }
     $titles = array(0 => 'id_produit', 1 => 'nom_produit', 2 => 'url_produit', 3 => 'url_image', 4 => 'description', 5 => 'description_courte', 6 => 'prix', 7 => 'prix_barre', 8 => 'frais_de_port', 9 => 'delaiLiv', 10 => 'marque', 11 => 'rayon', 12 => 'stock', 13 => 'qte_stock', 14 => 'EAN', 15 => 'poids', 16 => 'ecotaxe', 17 => 'TVA', 18 => 'Reference constructeur', 19 => 'Reference fournisseur');
     echo implode("|", $titles) . "\r\n";
     //For Shipping
     $configuration = Configuration::getMultiple(array('PS_TAX_ADDRESS_TYPE', 'PS_CARRIER_DEFAULT', 'PS_COUNTRY_DEFAULT', 'PS_LANG_DEFAULT', 'PS_SHIPPING_FREE_PRICE', 'PS_SHIPPING_HANDLING', 'PS_SHIPPING_METHOD', 'PS_SHIPPING_FREE_WEIGHT'));
     $products = Product::getSimpleProducts($configuration['PS_LANG_DEFAULT']);
     $defaultCountry = new Country($configuration['PS_COUNTRY_DEFAULT'], Configuration::get('PS_LANG_DEFAULT'));
     $id_zone = (int) $defaultCountry->id_zone;
     $carrier = new Carrier((int) $configuration['PS_CARRIER_DEFAULT']);
     $carrierTax = Tax::getCarrierTaxRate((int) $carrier->id, (int) $this->{$configuration['PS_TAX_ADDRESS_TYPE']});
     foreach ($products as $key => $produit) {
         $product = new Product((int) $produit['id_product'], true, $configuration['PS_LANG_DEFAULT']);
         //For links
         $link = new Link();
         //For images
         $cover = $product->getCover($product->id);
         $ids = $product->id . '-' . $cover['id_image'];
         //For shipping
         if ($product->getPrice(true, NULL, 2, NULL, false, true, 1) >= (double) $configuration['PS_SHIPPING_FREE_PRICE'] and (double) $configuration['PS_SHIPPING_FREE_PRICE'] > 0) {
             $shipping = 0;
         } elseif (isset($configuration['PS_SHIPPING_FREE_WEIGHT']) and $product->weight >= (double) $configuration['PS_SHIPPING_FREE_WEIGHT'] and (double) $configuration['PS_SHIPPING_FREE_WEIGHT'] > 0) {
             $shipping = 0;
         } else {
             if (isset($configuration['PS_SHIPPING_HANDLING']) and $carrier->shipping_handling) {
                 $shipping = (double) $configuration['PS_SHIPPING_HANDLING'];
             }
             if ($carrier->getShippingMethod() == Carrier::SHIPPING_METHOD_WEIGHT) {
                 $shipping += $carrier->getDeliveryPriceByWeight($product->weight, $id_zone);
             } else {
                 $shipping += $carrier->getDeliveryPriceByPrice($product->getPrice(true, NULL, 2, NULL, false, true, 1), $id_zone);
             }
             $shipping *= 1 + $carrierTax / 100;
             $shipping = (double) Tools::ps_round((double) $shipping, 2);
         }
         $data = array();
         $data[0] = $product->id;
         $data[1] = $product->name;
         $data[2] = $link->getProductLink($product);
         $data[3] = $link->getImageLink($product->link_rewrite, $ids, 'large');
         $data[4] = $product->description;
         $data[5] = $product->description_short;
         $data[6] = $product->getPrice(true, NULL, 2, NULL, false, true, 1);
         $data[7] = $product->getPrice(true, NULL, 2, NULL, false, false, 1);
         $data[8] = $shipping;
         $data[9] = $carrier->delay[2];
         $data[10] = $product->manufacturer_name;
         $data[11] = $product->category;
         $data[12] = $product->quantity > 0 ? 'oui' : 'non';
         $data[13] = $product->quantity;
         $data[14] = $product->ean13;
         $data[15] = $product->weight;
         $data[16] = $product->ecotax;
         $data[17] = $product->tax_rate;
         $data[18] = $product->reference;
         $data[19] = $product->supplier_reference;
         foreach ($data as $key => $value) {
             $data[$key] = $this->clean($value);
         }
         echo implode("|", $data) . "\r\n";
     }
 }
开发者ID:ricardo-rdfs,项目名称:Portal-BIP,代码行数:65,代码来源:shoppingfluxexport.php

示例11: _getProductLink

 /**
  * Hydrate $link_sitemap with products link
  *
  * @param array  $link_sitemap contain all the links for the Google Sitemap file to be generated
  * @param string $lang         language of link to add
  * @param int    $index        index of the current Google Sitemap file
  * @param int    $i            count of elements added to sitemap main array
  * @param int    $id_product   product object identifier
  *
  * @return bool
  */
 private function _getProductLink(&$link_sitemap, $lang, &$index, &$i, $id_product = 0)
 {
     $link = new Link();
     if (method_exists('ShopUrl', 'resetMainDomainCache')) {
         ShopUrl::resetMainDomainCache();
     }
     $products_id = Db::getInstance()->ExecuteS('SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product_shop` WHERE `active` = 1 AND `id_shop`=' . $this->context->shop->id);
     foreach ($products_id as $product_id) {
         $product = new Product((int) $product_id['id_product'], false, (int) $lang['id_lang']);
         if (_PS_VERSION_ >= 1.5) {
             $url = $link->getProductLink($product, $product->link_rewrite, htmlspecialchars(strip_tags($product->category)), $product->ean13, (int) $lang['id_lang'], (int) $this->context->shop->id, 0, true);
         } else {
             $category = new Category((int) $product->id_category_default, (int) $lang['id_lang']);
             $url = $link->getProductLink($product, Configuration::get('PS_REWRITING_SETTINGS') ? $product->link_rewrite : false, htmlspecialchars(strip_tags($category->name)), $product->ean13, (int) $lang['id_lang']);
         }
         $id_image = Product::getCover((int) $product_id['id_product']);
         if (isset($id_image['id_image'])) {
             $image_link = $this->context->link->getImageLink($product->link_rewrite, $product->id . '-' . (int) $id_image['id_image']);
             $image_link = !in_array(rtrim(Context::getContext()->shop->virtual_uri, '/'), explode('/', $image_link)) ? str_replace(array('https', Context::getContext()->shop->domain . Context::getContext()->shop->physical_uri), array('http', Context::getContext()->shop->domain . Context::getContext()->shop->physical_uri . Context::getContext()->shop->virtual_uri), $image_link) : $image_link;
         }
         $file_headers = Configuration::get('GSITEMAP_CHECK_IMAGE_FILE') ? @get_headers($image_link) : true;
         $image_product = array();
         if (isset($image_link) && ($file_headers[0] != 'HTTP/1.1 404 Not Found' || $file_headers === true)) {
             $image_product = array('title_img' => htmlspecialchars(strip_tags($product->name)), 'caption' => htmlspecialchars(strip_tags($product->description_short)), 'link' => $image_link);
         }
         if (!$this->_addLinkToSitemap($link_sitemap, array('type' => 'product', 'page' => 'product', 'lastmod' => $product->date_upd, 'link' => $url, 'image' => $image_product), $lang['iso_code'], $index, $i, $product_id['id_product'])) {
             return false;
         }
         unset($image_link);
     }
     return true;
 }
开发者ID:ventsiwad,项目名称:presta_addons,代码行数:43,代码来源:gsitemap.php

示例12: getUrlsProduct

 public static function getUrlsProduct($product_id)
 {
     $product_exist = Db::getInstance()->getRow('SELECT * FROM ' . _DB_PREFIX_ . 'product WHERE id_product =' . (int) $product_id);
     if ($product_exist) {
         $o_product = new Product($product_id, false, (int) Configuration::get('PS_LANG_DEFAULT'));
         $protocol_link = Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode() ? 'https://' : 'http://';
         $use_ssl = Configuration::get('PS_SSL_ENABLED') || Tools::usingSecureMode() ? true : false;
         $protocol_content = $use_ssl ? 'https://' : 'http://';
         $link = new Link($protocol_link, $protocol_content);
         $id_cover_image = Image::getCover($product_id);
         $image_path = $link->getImageLink($o_product->link_rewrite[(int) Configuration::get('PS_LANG_DEFAULT')], $id_cover_image['id_image']);
         $url_product = $link->getProductLink($product_id);
         return array('url_product' => $url_product, 'url_image_product' => $image_path);
     }
 }
开发者ID:TheTypoMaster,项目名称:neonflexible,代码行数:15,代码来源:NetReviewsModel.php

示例13: getProductProperties

 public static function getProductProperties($id_lang, $row)
 {
     if (!$row['id_product']) {
         return false;
     }
     // Product::getDefaultAttribute is only called if id_product_attribute is missing from the SQL query at the origin of it: consider adding it in order to avoid unnecessary queries
     $row['allow_oosp'] = Product::isAvailableWhenOutOfStock($row['out_of_stock']);
     if ((!isset($row['id_product_attribute']) or !$row['id_product_attribute']) and (isset($row['cache_default_attribute']) and ($ipa_default = $row['cache_default_attribute']) !== NULL or $ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))) {
         $row['id_product_attribute'] = $ipa_default;
     }
     if (!isset($row['id_product_attribute'])) {
         $row['id_product_attribute'] = 0;
     }
     // Tax
     $usetax = Tax::excludeTaxeOption();
     $cacheKey = $row['id_product'] . '-' . $row['id_product_attribute'] . '-' . $id_lang . '-' . (int) $usetax;
     if (array_key_exists($cacheKey, self::$producPropertiesCache)) {
         return self::$producPropertiesCache[$cacheKey];
     }
     // Datas
     $link = new Link();
     $row['category'] = Category::getLinkRewrite((int) $row['id_category_default'], (int) $id_lang);
     $row['link'] = $link->getProductLink((int) $row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);
     $row['attribute_price'] = (isset($row['id_product_attribute']) and $row['id_product_attribute']) ? (double) Product::getProductAttributePrice($row['id_product_attribute']) : 0;
     $row['price_tax_exc'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, self::$_taxCalculationMethod == PS_TAX_EXC ? 2 : 6);
     if (self::$_taxCalculationMethod == PS_TAX_EXC) {
         $row['price_tax_exc'] = Tools::ps_round($row['price_tax_exc'], 2);
         $row['price'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], false, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2, NULL, false, false);
     } else {
         $row['price'] = Tools::ps_round(Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 2), 2);
         $row['price_without_reduction'] = Product::getPriceStatic((int) $row['id_product'], true, (isset($row['id_product_attribute']) and !empty($row['id_product_attribute'])) ? (int) $row['id_product_attribute'] : NULL, 6, NULL, false, false);
     }
     $row['reduction'] = Product::getPriceStatic((int) $row['id_product'], (bool) $usetax, (int) $row['id_product_attribute'], 6, NULL, true, true, 1, true, NULL, NULL, NULL, $specific_prices);
     $row['specific_prices'] = $specific_prices;
     if ($row['id_product_attribute']) {
         $row['quantity_all_versions'] = $row['quantity'];
         $row['quantity'] = Product::getQuantity((int) $row['id_product'], $row['id_product_attribute'], isset($row['cache_is_pack']) ? $row['cache_is_pack'] : NULL);
     }
     $row['id_image'] = Product::defineProductImage($row, $id_lang);
     $row['features'] = Product::getFrontFeaturesStatic((int) $id_lang, $row['id_product']);
     $row['attachments'] = (!isset($row['cache_has_attachments']) or $row['cache_has_attachments']) ? Product::getAttachmentsStatic((int) $id_lang, $row['id_product']) : array();
     // Pack management
     $row['pack'] = !isset($row['cache_is_pack']) ? Pack::isPack($row['id_product']) : (int) $row['cache_is_pack'];
     $row['packItems'] = $row['pack'] ? Pack::getItemTable($row['id_product'], $id_lang) : array();
     $row['nopackprice'] = $row['pack'] ? Pack::noPackPrice($row['id_product']) : 0;
     if ($row['pack'] and !Pack::isInStock($row['id_product'])) {
         $row['quantity'] = 0;
     }
     self::$producPropertiesCache[$cacheKey] = $row;
     return self::$producPropertiesCache[$cacheKey];
 }
开发者ID:srikanthash09,项目名称:codetestdatld,代码行数:52,代码来源:Product.php

示例14: displayFormInformations

    function displayFormInformations($obj, $currency, $languages, $defaultLanguage)
    {
        global $currentIndex, $cookie;
        $iso = Language::getIsoById(intval($cookie->id_lang));
        $divLangName = 'cname¤cdesc¤cdesc_short¤clink_rewrite¤cmeta_description¤cmeta_title¤cmeta_keywords¤ctags¤cavailable_now¤cavailable_later';
        $qty_state = 'readonly';
        $qty = Attribute::getAttributeQty($this->getFieldValue($obj, 'id_product'));
        if ($qty === false) {
            if (Validate::isLoadedObject($obj)) {
                $qty = $this->getFieldValue($obj, 'quantity');
            } else {
                $qty = 1;
            }
            $qty_state = '';
        }
        $cover = Product::getCover($obj->id);
        $link = new Link();
        //includeDatepicker(array('reduction_from', 'reduction_to'));
        echo '
		<div class="tab-page" id="step1">
			<h4 class="tab">1. ' . $this->l('Info.') . '</h4>
			<b>' . $this->l('Product global informations') . '</b>&nbsp;-&nbsp;';
        if (isset($obj->id)) {
            echo '
			<a href="' . $link->getProductLink($this->getFieldValue($obj, 'id'), $this->getFieldValue($obj, 'link_rewrite', $defaultLanguage), Category::getLinkRewrite($this->getFieldValue($obj, 'id_category_default'), intval($cookie->id_lang))) . '"><img src="../img/admin/details.gif" alt="' . $this->l('View product in shop') . '" title="' . $this->l('View product in shop') . '" /> ' . $this->l('View product in shop') . '</a>';
            if (file_exists(_PS_MODULE_DIR_ . 'statsproduct/statsproduct.php')) {
                echo '&nbsp;-&nbsp;
					<a href="index.php?tab=AdminStatsModules&module=statsproduct&id_product=' . $obj->id . '&token=' . Tools::getAdminToken('AdminStatsModules' . intval(Tab::getIdFromClassName('AdminStatsModules')) . intval($cookie->id_employee)) . '"><img src="../modules/statsproduct/logo.gif" alt="' . $this->l('View product sales') . '" title="' . $this->l('View product sales') . '" /> ' . $this->l('View product sales') . '</a>';
            }
        }
        echo '	
			<hr class="clear"/>
			<br />
				<table cellpadding="5" style="width:100%">
					<tr>
						<td class="col-left">' . $this->l('Name:') . '</td>
						<td style="padding-bottom:5px;">';
        foreach ($languages as $language) {
            echo '			<div id="cname_' . $language['id_lang'] . '" style="display: ' . ($language['id_lang'] == $defaultLanguage ? 'block' : 'none') . '; float: left;">
								<input size="55" type="text" id="name_' . $language['id_lang'] . '" name="name_' . $language['id_lang'] . '"
								value="' . stripslashes(htmlspecialchars($this->getFieldValue($obj, 'name', $language['id_lang']))) . '"' . (!$obj->id ? ' onkeyup="copy2friendlyURL();"' : '') . ' onchange="updateCurrentText();" /><sup> *</sup>
								<span class="hint" name="help_box">' . $this->l('Invalid characters:') . ' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
							</div>';
        }
        $this->displayFlags($languages, $defaultLanguage, $divLangName, 'cname');
        echo '<script type="text/javascript">updateCurrentText();</script>
						</td>
					</tr>
					<tr>
						<td style="vertical-align:top">' . $this->l('Status:') . '</td>
						<td style="padding-bottom:5px;">
							<input style="float:left;" type="radio" name="active" id="active_on" value="1" ' . ($this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_on" class="t"><img src="../img/admin/enabled.gif" alt="' . $this->l('Enabled') . '" title="' . $this->l('Enabled') . '" style="float:left; padding:0px 5px 0px 5px;" />' . $this->l('Enabled') . '</label>
							<br style="clear:both;" />
							<input style="float:left;" type="radio" name="active" id="active_off" value="0" ' . (!$this->getFieldValue($obj, 'active') ? 'checked="checked" ' : '') . '/>
							<label for="active_off" class="t"><img src="../img/admin/disabled.gif" alt="' . $this->l('Disabled') . '" title="' . $this->l('Disabled') . '" style="float:left; padding:0px 5px 0px 5px" />' . $this->l('Disabled') . '</label>
						</td>
					</tr>
					<tr>
						<td>' . $this->l('Manufacturer:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_manufacturer" id="id_manufacturer">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_manufacturer = $this->getFieldValue($obj, 'id_manufacturer')) {
            echo '				<option value="' . $id_manufacturer . '" selected="selected">' . Manufacturer::getNameById($id_manufacturer) . '</option>
								<option disabled="disabled">----------</option>';
        }
        echo '
							</select>&nbsp;&nbsp;&nbsp;<a href="?tab=AdminManufacturers&addmanufacturer&token=' . Tools::getAdminToken('AdminManufacturers' . intval(Tab::getIdFromClassName('AdminManufacturers')) . intval($cookie->id_employee)) . '" onclick="return confirm(\'' . $this->l('Are you sure you want to delete entered product information?', __CLASS__, true, false) . '\');"><img src="../img/admin/add.gif" alt="' . $this->l('Create') . '" title="' . $this->l('Create') . '" /> <b>' . $this->l('Create') . '</b></a>
							<script type="text/javascript">
								var ajaxManufacturersClicked = false;
								$("select#id_manufacturer").focus(
									function() {
										if (ajaxManufacturersClicked == true) return; else ajaxManufacturersClicked = true;
										$.getJSON("' . dirname($currentIndex) . '/ajax.php",{ajaxProductManufacturers:1},
											function(j) {
												var options = \'\';
												for (var i = 0; i < getE("id_manufacturer").options.length; i++)
												{
													if (getE("id_manufacturer").options[i].innerHTML == \'----------\')
														options += \'<option disabled="disabled">----------</option>\';
													else
														options += \'<option value="\' +  getE("id_manufacturer").options[i].value + \'">\' + getE("id_manufacturer").options[i].innerHTML + \'</option>\';
												}
												for (var i = 0; i < j.length; i++)
													options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
												$("select#id_manufacturer").html(options);
											}
										)
									}
								);
							</script>
						</td>
					</tr>
					<tr>
						<td>' . $this->l('Supplier:') . '</td>
						<td style="padding-bottom:5px;">
							<select name="id_supplier" id="id_supplier">
								<option value="0">-- ' . $this->l('Choose (optional)') . ' --</option>';
        if ($id_supplier = $this->getFieldValue($obj, 'id_supplier')) {
//.........这里部分代码省略.........
开发者ID:raulgimenez,项目名称:dreamongraphics_shop,代码行数:101,代码来源:AdminProducts.php

示例15: getProductLink

 /**
  * @param \Product $product
  *
  * @return string
  * @throws \PrestaShopException
  * @author Panagiotis Vagenas <pan.vagenas@gmail.com>
  * @since 150213
  */
 protected function getProductLink(\Product &$product)
 {
     $link = new \Link();
     $pLink = $link->getProductLink($product);
     return urldecode($this->addHttp($pLink));
 }
开发者ID:panvagenas,项目名称:prestashop-skroutz-xml-feed,代码行数:14,代码来源:Skroutz.php


注:本文中的Link::getProductLink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。