Jump to content

Erreur cache smarty product.tpl


Grafyx89
 Share

Recommended Posts

Hello à tous,

 

Comme déjà évoqué dans ce forum, j'utilise beaucoup la variable manufacturer, je l'ajoute beaucoup en tout cas, du moins j’essaie !

 

Seulement voilà, cette variable semble être complexe. En effet, par exemple je l'ajoute dans le module crossselling, cette dernière étais affiché, et d'un coup, le nom du fabricant ne s'affiche plus .. quand j'active le mode debug, il en ressort l'erreur suivante :

Notice: Undefined index: manufacturer_name in /var/www/web/boutique/cache/smarty/compile/e5/25/74/e5257479459ff6291b9c32ddbcd209145c71dff1.file.crossselling.tpl.php on line 56 - See more at: http://www.hardloop.fr/boutique/sous-vetements-haut-femme/1543-icebreaker-sous-vetement-technique-oasis-long-sleeve-crew-femme.html#sthash.lxYiHQ6C.dpuf

Cette erreur me rend dingue car ça marchais juste avant sans rien toucher, c'est fou.

 

Merci de votre aide,

Bonne journée !

Share this post


Link to post
Share on other sites

En réalité, c'est surtout sur la page produit que la variable manufacturer à du mal.

 

Maintenant j'ai l'erreur :

Notice: Undefined index: Product in /var/www/web/boutique/cache/smarty/compile/e5/25/74/e5257479459ff6291b9c32ddbcd209145c71dff1.file.crossselling.tpl.php on line 57

Pourtant le cache est désactivé.

$smarty->caching = false;
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') >= _PS_SMARTY_CHECK_COMPILE_) ? true : false;

Merci de ta réponse en tout cas, ça fait plaisir, je commençais à désespérer :)

Share this post


Link to post
Share on other sites

tpl modifié de ? Product ?

 

C'est simple, dans ma page manufacturer.tpl, il a été créer un bloc :

{if isset($topVentesProducts) && $topVentesProducts|@count > 0}
    <div class="top-ventes no-padding">
        <h4 class="strike">{l s='Top ventes'} {$manufacturer->name|escape:'html':'UTF-8'}</h4>
        <div class="products logo featured">
    
            {foreach from=$topVentesProducts item=topVentesProduct}
            <div class="_slide">
                <a href="{$topVentesProduct.link|escape:'html':'UTF-8'}">
                    <img title="{$topVentesProduct.name|escape:'html':'UTF-8'} " alt="{$topVentesProduct.name|escape:'html':'UTF-8'}" data-id="{$topVentesProduct.id_product}" src="{$link->getImageLink($topVentesProduct.link_rewrite, $topVentesProduct.id_image, 'home_default')|escape:'html':'UTF-8'}" class="product">
                    {if $topVentesProduct.specific_prices.reduction_type == 'percentage' && (($topVentesProduct.specific_prices.reduction*100) > 0)}
                    <span class="sale-box no-print">-{$topVentesProduct.specific_prices.reduction * 100}%</span>
                    {/if}
                </a>
                <div class="information">
                    <div class="manufacturer">{$topVentesProduct.manufacturer_name|truncate:45:'...'|escape:'html':'UTF-8'}</div>
                    <div class="name">{$topVentesProduct.name|truncate:45:'...'|escape:'html':'UTF-8'}</div>
                    <div class="price">
                        {if !$priceDisplay}{convertPrice price=$topVentesProduct.price}{else}{convertPrice price=$topVentesProduct.price_tax_exc}{/if}
                        {if isset($topVentesProduct.specific_prices) && $topVentesProduct.specific_prices && isset($topVentesProduct.specific_prices.reduction) && $topVentesProduct.specific_prices.reduction > 0}
                            {hook h="displayProductPriceBlock" product=$topVentesProduct type="old_price"}
                            <span class="old-price product-price">
                                {displayWtPrice p=$topVentesProduct.price_without_reduction}
                            </span>
                        {/if}
                    </div>
                </div>        
            </div>
            {/foreach}
            
        </div>
        <div class="clearfix"> </div>
    </div>
    {/if}

Cela affiche le top ventes des fabricants. Pour l'affiché dans product.tpl, j'ai en effet été dans le ManufacturerController.php qui appel cette fonction ($topVentesProducts) :

protected function assignOne()
    {
        parent::assignOne();

        $this->addJqueryPlugin('bxslider');

        $this->context->smarty->assign(array(
            'last_comments' => 'last_comments'
        ));

        $nosCoupsDeCoeurProducts = $this->manufacturer->getProducts(
            $this->manufacturer->id,
            $this->context->language->id,
            1,
            4,
            null,
            null,
            false,
            true,
            true,
            null,
            585
        );
        if (!empty($nosCoupsDeCoeurProducts)) {
            $this->context->smarty->assign('nosCoupsDeCoeurProducts', $nosCoupsDeCoeurProducts);
        }

        $topVentesProducts = $this->manufacturer->getTopDesVentesProducts(
            $this->manufacturer->id,
            $this->context->language->id,
            1,
            4
        );
        if (!empty($topVentesProducts)) {
            $this->context->smarty->assign('topVentesProducts', $topVentesProducts);
        }

        // start get latest comment from manufacturer's products
        $psComments = array();

        $sql = 'SELECT *
                FROM `' . _DB_PREFIX_ . 'product_comment` pc
                LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON pc.`id_product` = p.`id_product`
                WHERE p.`id_manufacturer` = ' . (int)$this->manufacturer->id . '
                ORDER BY pc.`date_add` DESC
                LIMIT 0, 2';
        $result = DB::getInstance()->executeS($sql);
        foreach ($result as $row) {
            $product = new \Product($row['id_product'], false, $this->context->language->id);
            $imageRow = \Image::getCover($row['id_product']);

            $psComments[] = array(
                'img_url' => $this->context->link->getImageLink($product->link_rewrite, $imageRow['id_image'], 'medium_default'),
                'product_url' => $this->context->link->getProductLink($row['id_product']),
                'title' => $row['title'],
                'content' => $row['content'],
                'customer' => $row['customer_name'],
                'date' => strtolower(strftime('%e %b. %Y', strtotime($row['date_add']))), //17 oct. 2014
            );
        }

        if (!empty($psComments)) {
            $this->context->smarty->assign('psComments', $psComments);
        }
        // end get latest comment from manufacturer's products
    }

    /**
     * Assign template vars if displaying the manufacturer list
     */
    protected function assignAll()
    {
        parent::assignAll();
    }

Que j'ai inséré dans ProductController.php, et copié/collé le code dit en amont dans le .tpl

 

Il n'affiche pas ce qu'il faut.

 

En parallèle, il a été créer un top vente par catégorie de la même manière en html, j'ai donc pris la fonction qui appel $topVentesProduct  aussi et je l'ai copiée dans ProductController.php. Idem, j'ai aussi copié le code html inscris dans categorie.tpl (qui est relativement le même que dans manufacturer.tpl) et par contre, la il m'affiche bien les meilleures par catégories ..

J'imagine donc qu'il y a un problème avec cette variable manufacturer pour qu'elle disparaisse, réapparaisse, dans crosselling aussi ..

J'ai tellement réfléchi et essayé de solutions que je n'y vois plus aucunes ^^

 

Merci encore :)

Share this post


Link to post
Share on other sites

Au vu d'une structure de tables que j'ai en local, et au vu de ta requête avec jointure sur les manufacturer, je peux te dire que manufacturer_name n'existe pas.

Dans la table ps_manufacturer tu as le champ name mais pas manufacturer_name. Mais au vu de ta jointure, tu ne fais pas appel à cette table. Il te reste donc les product_comment, dans laquelle il sembelrait que tu aies inséré les noms des fabricants.

Va dans la table, et passe la requête suivante par exemple :

SELECT *
                FROM `ps_product_comment` pc
                LEFT JOIN `ps_product` p ON pc.`id_product` = p.`id_product`
                WHERE p.`id_manufacturer` >0
                ORDER BY pc.`date_add` DESC

Regarde si tu as bien le champ manufacturer_name en tête de colonne dans les enregistrements retournés et que les champs que tu affiches dans le tpl soient tous bien là.

Share this post


Link to post
Share on other sites

Très franchement non pas trop ..

En plus je ne gère pas la base de donnée, elle est géré par un prestataire qui ne comprend pas qu'il faut envoyer les accès. Visiblement il n'y a pas phpmyadmin dessus. Heureusement que c'est un serveur de dev haha.

Share this post


Link to post
Share on other sites

Mon ManufacturerController.php :
 
 

<?php

/*
 * 2007-2014 PrestaShop
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to http://www.prestashop.com for more information.
 *
 *  @author PrestaShop SA <[email protected]>
 *  @copyright  2007-2014 PrestaShop SA
 *  @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 *  International Registered Trademark & Property of PrestaShop SA
 */

class ManufacturerController extends ManufacturerControllerCore
{
    /**
     * Assign template vars if displaying one manufacturer
     */
    protected function assignOne()
    {
        parent::assignOne();

        $this->addJqueryPlugin('bxslider');

        $this->context->smarty->assign(array(
            'last_comments' => 'last_comments'
        ));

        $nosCoupsDeCoeurProducts = $this->manufacturer->getProducts(
            $this->manufacturer->id,
            $this->context->language->id,
            1,
            4,
            null,
            null,
            false,
            true,
            true,
            null,
            585
        );
        if (!empty($nosCoupsDeCoeurProducts)) {
            $this->context->smarty->assign('nosCoupsDeCoeurProducts', $nosCoupsDeCoeurProducts);
        }

        $topVentesProducts = $this->manufacturer->getTopDesVentesProducts(
            $this->manufacturer->id,
            $this->context->language->id,
            1,
            4
        );
        if (!empty($topVentesProducts)) {
            $this->context->smarty->assign('topVentesProducts', $topVentesProducts);
        }

        // start get latest comment from manufacturer's products
        $psComments = array();

        $sql = 'SELECT *
                FROM `' . _DB_PREFIX_ . 'product_comment` pc
                LEFT JOIN `' . _DB_PREFIX_ . 'product` p ON pc.`id_product` = p.`id_product`
                WHERE p.`id_manufacturer` = ' . (int)$this->manufacturer->id . '
                ORDER BY pc.`date_add` DESC
                LIMIT 0, 2';
        $result = DB::getInstance()->executeS($sql);
        foreach ($result as $row) {
            $product = new \Product($row['id_product'], false, $this->context->language->id);
            $imageRow = \Image::getCover($row['id_product']);

            $psComments[] = array(
                'img_url' => $this->context->link->getImageLink($product->link_rewrite, $imageRow['id_image'], 'medium_default'),
                'product_url' => $this->context->link->getProductLink($row['id_product']),
                'title' => $row['title'],
                'content' => $row['content'],
                'customer' => $row['customer_name'],
                'date' => strtolower(strftime('%e %b. %Y', strtotime($row['date_add']))), //17 oct. 2014
            );
        }

        if (!empty($psComments)) {
            $this->context->smarty->assign('psComments', $psComments);
        }
        // end get latest comment from manufacturer's products
    }

    /**
     * Assign template vars if displaying the manufacturer list
     */
    protected function assignAll()
    {
        parent::assignAll();
    }

}

Mon ProductControllers.php :

<?php
class Product extends ProductCore
{
	public static function getTopDesVentesProducts($id_manufacturer, $id_lang, $p, $n, $order_by = null, $order_way = null,
	    $get_total = false, $active = true, $active_category = true, Context $context = null)
	{
	    if (!$context)
	        $context = Context::getContext();

	    $front = true;
	    if (!in_array($context->controller->controller_type, array('front', 'modulefront')))
	        $front = false;

	    if ($p < 1)
	        $p = 1;

	    if (empty($order_by))
	        $order_by = 'product_quantity';

	    if (empty($order_way))
	        $order_way = 'DESC';

	    if (!Validate::isOrderBy($order_by) || !Validate::isOrderWay($order_way))
	        die (Tools::displayError());

	    $groups = FrontController::getCurrentCustomerGroups();
	    $sql_groups = count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1';

	    /* Return only the number of products */
	    if ($get_total)
	    {
	        $sql = '
				SELECT p.`id_product`
				FROM `'._DB_PREFIX_.'product` p
				'.Shop::addSqlAssociation('product', 'p').'
				WHERE p.id_manufacturer = '.(int)$id_manufacturer
					.($active ? ' AND product_shop.`active` = 1' : '').'
				'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
				AND p.`id_product` IN (
					SELECT cp.`id_product`
					FROM `'._DB_PREFIX_.'category_group` cg
					LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
						($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
					WHERE cg.`id_group` '.$sql_groups.'
				)';

	        $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
	        return (int)count($result);
	    }

	    if (strpos($order_by, '.') > 0) {
	        $order_by = explode('.', $order_by);
	        $order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
	    }

	    $alias = '';
	    if ($order_by == 'price') {
	        $alias = 'product_shop.';
	    }
	    elseif ($order_by == 'name') {
	        $alias = 'pl.';
	    }
	    elseif ($order_by == 'manufacturer_name') {
	        $order_by = 'name';
	        $alias = 'm.';
	    }
	    elseif ($order_by == 'quantity') {
	        $alias = 'stock.';
	    }
	    elseif ($order_by != 'product_quantity') {
	        $alias = 'p.';
	    }

	    $sql = 'SELECT
                    p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.`id_product_attribute`) id_product_attribute,
    				pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`,
    				pl.`meta_title`, pl.`name`, pl.`available_now`, pl.`available_later`, MAX(image_shop.`id_image`) id_image, il.`legend`, m.`name` AS manufacturer_name,
                    DATEDIFF(
    				    product_shop.`date_add`,
    					DATE_SUB(
                            NOW(),
                            INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY
                        )
                    ) > 0 AS new,
                    SUM(od.`product_quantity`) AS `product_quantity`
                FROM (
                    SELECT p.`id_product`
    				FROM `'._DB_PREFIX_.'product` p
    				'.Shop::addSqlAssociation('product', 'p').'
    				WHERE p.id_manufacturer = '.(int)$id_manufacturer
    					.($active ? ' AND product_shop.`active` = 1' : '').'
    				'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
    				AND p.`id_product` IN (
    					SELECT cp.`id_product`
    					FROM `'._DB_PREFIX_.'category_group` cg
    					LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`)'.
    						($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
    					WHERE cg.`id_group` '.$sql_groups.'
    				)
                ) tmp
                LEFT JOIN `'._DB_PREFIX_.'product` p
                    ON (tmp.`id_product` = p.`id_product`)
 				'.Shop::addSqlAssociation('product', 'p').'
   				LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa
   					ON (p.`id_product` = pa.`id_product`)
   				'.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').'
   				LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
   					ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
   				LEFT JOIN `'._DB_PREFIX_.'image` i
   					ON (i.`id_product` = p.`id_product`)'.Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').'
   				LEFT JOIN `'._DB_PREFIX_.'image_lang` il
   					ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
   				LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
   					ON (m.`id_manufacturer` = p.`id_manufacturer`)
   				'.Product::sqlStock('p', 0).'
                LEFT JOIN `' . _DB_PREFIX_ . 'order_detail` od
                    ON p.`id_product` = od.`product_id`
   				WHERE p.`id_manufacturer` = '.(int)$id_manufacturer.'
   				'.($active ? ' AND product_shop.`active` = 1' : '').'
   				'.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '').'
   				AND p.`id_product` IN (
   					SELECT cp.`id_product`
   					FROM `'._DB_PREFIX_.'category_group` cg
   					LEFT JOIN `'._DB_PREFIX_.'category_product` cp
   						ON (cp.`id_category` = cg.`id_category`)'.($active_category ? ' INNER JOIN `'._DB_PREFIX_.'category` ca ON cp.`id_category` = ca.`id_category` AND ca.`active` = 1' : '').'
   					WHERE cg.`id_group` '.$sql_groups.'
                )
    			GROUP BY product_shop.id_product
				ORDER BY '.$alias.'`'.bqSQL($order_by).'` '.pSQL($order_way).'
				LIMIT '.(((int)$p - 1) * (int)$n).','.(int)$n;

	    $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);

	    if (!$result)
	        return false;

	    if ($order_by == 'price')
	        Tools::orderbyPrice($result, $order_way);

	    return Product::getProductsProperties($id_lang, $result);
	}

	


	//////////////
	
    public static function getFrontFeaturesStatic($id_lang, $id_product)
    {
        if (!Feature::isFeatureActive())
            return array();
        if (!array_key_exists($id_product.'-'.$id_lang, self::$_frontFeaturesCache))
        {
            self::$_frontFeaturesCache[$id_product.'-'.$id_lang] = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
				SELECT `name`, `value`, pf.`id_feature`, pf.`id_feature_value`
				FROM '._DB_PREFIX_.'feature_product pf
				LEFT JOIN '._DB_PREFIX_.'feature_lang fl ON (fl.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = pf.id_feature_value AND fvl.id_lang = '.(int)$id_lang.')
				LEFT JOIN '._DB_PREFIX_.'feature f ON (f.id_feature = pf.id_feature AND fl.id_lang = '.(int)$id_lang.')
				'.Shop::addSqlAssociation('feature', 'f').'
				WHERE pf.id_product = '.(int)$id_product.'
				ORDER BY f.position ASC'
            );
        }
        return self::$_frontFeaturesCache[$id_product.'-'.$id_lang];
    }

    public static function getFeaturesGroupped($features = null, $id_product = null, $id_lang = null)
    {
        $grouppedFeatures = array();

        if (is_null($features) && !is_null($product_id) && !is_null($id_lang)) {
            $features = parent::getFrontFeaturesStatic($id_lang, $id_product);
        }

        if (!is_null($features) && !empty($features)) {
            foreach ($features as $featureArr) {
                if (!isset($grouppedFeatures[$featureArr['id_feature']])) {
                    $grouppedFeatures[$featureArr['id_feature']] = array();
                }

                $grouppedFeatures[$featureArr['id_feature']][] = $featureArr['value'];
            }
        }

        return $grouppedFeatures;
    }

	
	public static function getProductProperties($id_lang, $row, Context $context = null)
	{
		if (!$row['id_product'])
			return false;

		if ($context == null)
			$context = Context::getContext();

		// 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 (Combination::isFeatureActive() && (!isset($row['id_product_attribute']) || !$row['id_product_attribute'])
			&& ((isset($row['cache_default_attribute']) && ($ipa_default = $row['cache_default_attribute']) !== null)
				|| ($ipa_default = Product::getDefaultAttribute($row['id_product'], !$row['allow_oosp']))))
			$row['id_product_attribute'] = $ipa_default;
		if (!Combination::isFeatureActive() || !isset($row['id_product_attribute']))
			$row['id_product_attribute'] = 0;

		// Tax
		$usetax = Tax::excludeTaxeOption();

		$cache_key = $row['id_product'].'-'.$row['id_product_attribute'].'-'.$id_lang.'-'.(int)$usetax;
		if (isset($row['id_product_pack']))
			$cache_key .= '-pack'.$row['id_product_pack'];

		if (isset(self::$producPropertiesCache[$cache_key]))
			return array_merge($row, self::$producPropertiesCache[$cache_key]);

		// Datas
		$row['category'] = Category::getLinkRewrite((int)$row['id_category_default'], (int)$id_lang);
		$row['link'] = $context->link->getProductLink((int)$row['id_product'], $row['link_rewrite'], $row['category'], $row['ean13']);

		$row['attribute_price'] = 0;
		if (isset($row['id_product_attribute']) && $row['id_product_attribute'])
			$row['attribute_price'] = (float)Product::getProductAttributePrice($row['id_product_attribute']);

		$row['price_tax_exc'] = Product::getPriceStatic(
			(int)$row['id_product'],
			false,
			((isset($row['id_product_attribute']) && !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']) && !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']) && !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']) && !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']) && !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;

		$row['quantity'] = Product::getQuantity(
			(int)$row['id_product'],
			0,
			isset($row['cache_is_pack']) ? $row['cache_is_pack'] : null
		);

		$row['quantity_all_versions'] = $row['quantity'];

		if ($row['id_product_attribute'])
			$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'] = array();
		if (!isset($row['cache_has_attachments']) || $row['cache_has_attachments'])
			$row['attachments'] = Product::getAttachmentsStatic((int)$id_lang, $row['id_product']);

		$row['virtual'] = ((!isset($row['is_virtual']) || $row['is_virtual']) ? 1 : 0);
		
		$attributesGroups = Db::getInstance()->ExecuteS('
			SELECT 	DISTINCT pa.`id_product_attribute`, a.`id_attribute` as id_attribute ,pa.`id_product`, a.`id_attribute_group`,  
					pai.`id_image`, i.`position`
					
			FROM `ps_product_attribute` pa
			LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
			LEFT JOIN `'._DB_PREFIX_.'product_attribute_image` pai ON pai.`id_product_attribute` = pa.`id_product_attribute`
			LEFT JOIN `'._DB_PREFIX_.'image` i ON i.`id_image` = pai.`id_image` 
			LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
			LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
		
			WHERE pa.`id_product` =  '.(int)$row['id_product'].'
			AND ag.`is_color_group` = 1

			ORDER BY i.`position` DESC');
			
		$combArray = null;
		foreach($attributesGroups AS $k => $combinaison){
			$combArray[$combinaison['id_attribute']]['id_image']=$combinaison['id_image'];
			$combArray[$combinaison['id_attribute']]['id_product']=$combinaison['id_product'];
			$combArray[$combinaison['id_attribute']]['id_attribute']=$combinaison['id_attribute'];
			$combArray[$combinaison['id_attribute']]['id_product_attribute']=$combinaison['id_product_attribute'];
			$combArray[$combinaison['id_attribute']]['id_attribute_group']=$combinaison['id_attribute_group'];
		}	
			
		$row['colors'] = $combArray;

		// 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'] && !Pack::isInStock($row['id_product']))
			$row['quantity'] = 0;

		$row = Product::getTaxesInformations($row, $context);
		self::$producPropertiesCache[$cache_key] = $row;
		return self::$producPropertiesCache[$cache_key];
	
	}
    	
    /**
     * Boost My Shop Product class override : load price from smartprice, $organization and $id_lang must be setted if $channel is null
     * if not, this method will return standard Prestashop price
     *
     * @param int $id_product
     * @param int $id_product_attribute
     * @param null|string $channel
     * @param null|string $organization
     * @param null|int $id_lang
     * @param null|int $store_id
     * @return float
     */
    public static function externalPrice($id_product, $id_product_attribute, $channel = null, $organization = null, $id_lang = null, $store_id = null)
    {
        $bmsperformance = Module::getInstanceByName('bmsperformance');
        if($bmsperformance->active) {

            return BmsperformanceClassesProduct::getPrice($id_product, $id_product_attribute, $channel, $organization, $id_lang, $store_id);

        }

        return self::getPriceStatic($id_product, true, $id_product_attribute);
    }

    /**
     * Boost My Shop Product class override : load shipping price from smartprice, $organization and $id_lang must be setted if $channel is null
     * if not, this method will return 0
     *
     * @param int $id_product
     * @param int $id_product_attribute
     * @param null|string $channel
     * @param null|string $organization
     * @param null|int $id_lang
     * @param null|int $store_id
     * @return float
     */
    public static function externalShipping($id_product, $id_product_attribute, $channel = null, $organization = null, $id_lang = null, $store_id = null)
    {
        $bmsperformance = Module::getInstanceByName('bmsperformance');
        if($bmsperformance->active) {

            return BmsperformanceClassesProduct::getShippingPrice($id_product, $id_product_attribute, $channel, $organization, $id_lang, $store_id);

        }

        return 0;
    }

    /**
     * @param int $id_product
     * @param int $id_product_attribute
     * @return array $features
     */
    public static function combinationFeatures($id_product, $id_product_attribute){

        $features = array();
        $bmsperformance = Module::getInstanceByName('bmsperformance');
        if($bmsperformance->active) {
 
            return BmsperformanceClassesCombination::getProductFeatureValueForAllChannels($id_product, $id_product_attribute);

        }

        return $features;
    }

    /**
     * @param int $id_product
     * @param int $id_product_attribute
     * @return string $xml
     */
    public static function combinationFeaturesAsXml($id_product, $id_product_attribute){

        $xml = '';

        foreach(self::combinationFeatures($id_product, $id_product_attribute) as $channel => $combinationFeature){

            foreach($combinationFeature as $featureLabel => $featureValue){

                $key = str_replace('_','','carl_'.$channel.'_'.$featureLabel);
            
                if(!empty($featureValue)){
                    
                    $xml .= '<'.$key.'><![CDATA['.$featureValue.']]></'.$key.'>';
                    
                }else{
                
                    $product = new Product($id_product);
                    $price = $product->getPrice(true, $id_product_attribute, 2, null, false, true, 1);
                    $xml .= '<'.$key.'><![CDATA['.$price.']]></'.$key.'>';
                
                }

            }

        }

        return $xml;

    }
	
	
}

Share this post


Link to post
Share on other sites

OK, manufacturer_name est un alias.

donc, il faut regarder dans ta base de données si tout est complet...

 

Très franchement non pas trop ..

En plus je ne gère pas la base de donnée, elle est géré par un prestataire qui ne comprend pas qu'il faut envoyer les accès. Visiblement il n'y a pas phpmyadmin dessus. Heureusement que c'est un serveur de dev haha.

Mais si tu as accès à ces fichiers, tu te poses un phpmyadmin ! tu as les mots de passe, c'est pas compliqué !

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More