Jump to content

[Résolu] V1.4.6.2 $product.description invisible et incompréhensible...


Recommended Posts

Bonsoir,

 

Je cherche à faire apparaître la description du produit dans le product-list en appelant (comme sur les versions précédentes) $product.description (de base, seul $product.description_short est affiché).

 

Or, la variable smarty n'est pas appelée :

 

1 => Array (37)
id_product => "10471"
on_sale => "0"
out_of_stock => "2"
available_for_order => "1"
quantity => "0"
minimal_quantity => "1"
id_category_default => "417"
customizable => "0"
show_price => "1"
weight => "0"
ean13 => "9782742428380"
available_later => "Envoi sous 4 à 8 jours"
[color=#ff0000]description_short => ""[/color]
link_rewrite => "new-york-geoguide"
name => "New York - GéoGuide"
id_image => "10471-9676"
legend => "New York - GéoGuide"
manufacturer_name => null
condition => "new"
id_manufacturer => "0"
new => "1"
allow_oosp => 1
id_product_attribute => "9249"
category => "usa"
link => "http://127.0.0.1/librairie/product.ph..."
attribute_price => 0
price_tax_exc => 14.9
price => 14.9
price_without_reduction => 14.9
reduction => 0
specific_prices => false
quantity_all_versions => "2"
features => Array (7)
  0 => Array (3)
	name => "Genre"
	value => "Tourisme"
	id_feature => "1"
  1 => Array (3)
	name => "Sujet"
	value => "Guide"
	id_feature => "2"
  2 => Array (3)
	name => "Pages"
	value => "480"
	id_feature => "3"
  3 => Array (3)
	name => "Pays"
	value => "USA"
	id_feature => "4"
  4 => Array (3)
	name => "Année"
	value => "0"
	id_feature => "5"
  5 => Array (3)
	name => "Disponibilité"
	value => "1"
	id_feature => "6"
  6 => Array (3)
	name => "Collection"
	value => "GéoGuide"
	id_feature => "7"
attachments => Array (0)
pack => false
packItems => Array (0)
nopackprice => 0

 

Alors que le fichier class/category.php semble l'appeler :

 

/* Return only the number of products */
 if ($getTotal)
 {
  $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
  SELECT COUNT(cp.`id_product`) AS total
  FROM `'._DB_PREFIX_.'product` p
  LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
  WHERE cp.`id_category` = '.(int)($this->id).($active ? ' AND p.`active` = 1' : '').'
  '.($id_supplier ? 'AND p.id_supplier = '.(int)($id_supplier) : ''));
  return isset($result) ? $result['total'] : 0;
 }
 $sql = '
 SELECT p.*, pa.`id_product_attribute`,[color=#ff0000] pl.`description`[/color], pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, cl.`name` AS category_default, DATEDIFF(p.`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,
  (p.`price` * IF(t.`rate`,((100 + (t.`rate`))/100),1)) AS orderprice
 FROM `'._DB_PREFIX_.'category_product` cp
 LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
 LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1)
 LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`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_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
										 AND tr.`id_country` = '.(int)Country::getDefaultCountryId().'
											AND tr.`id_state` = 0)
 LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
 LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)($id_lang).')
 LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON m.`id_manufacturer` = p.`id_manufacturer`
 WHERE cp.`id_category` = '.(int)($this->id).($active ? ' AND p.`active` = 1' : '').'
 '.($id_supplier ? 'AND p.id_supplier = '.(int)$id_supplier : '');

 

Comment faire ???

 

Merci

Link to comment
Share on other sites

J'avance :

 

Si je désinstalle le bloc layered, cela fonctionne...

 

Donc, modifier le bloclayered.php, vers la ligne 2000-2020 en rajoutant le pl.description :

 

$this->nbr_products = count($productIdList);

 if ($this->nbr_products == 0)
  $this->products = array();
 else
 {
  $n = (int)Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE'));
  $this->products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
  SELECT p.id_product, p.on_sale, p.out_of_stock, p.available_for_order, p.quantity, p.minimal_quantity, p.id_category_default, p.customizable, p.show_price, p.`weight`,
  p.ean13, pl.available_later, pl.description, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend,  m.name manufacturer_name, p.condition, p.id_manufacturer,
  DATEDIFF(p.`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
  FROM `'._DB_PREFIX_.'category_product` cp
  LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
  LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
  LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product)
  LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
  LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)($cookie->id_lang).')
  LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
  WHERE p.`active` = 1 AND
  '.(Configuration::get('PS_LAYERED_FULL_TREE') ? 'c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright : 'c.id_category = '.(int)$id_parent).'
  AND pl.id_lang = '.(int)$cookie->id_lang.'
  AND p.id_product IN ('.implode(',', $productIdList).')'
  .' GROUP BY p.id_product ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby'), true).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')).
  ' LIMIT '.(((int)Tools::getValue('p', 1) - 1) * $n.','.$n));

Link to comment
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
×
×
  • Create New...