senior426 Posted January 30, 2012 Share Posted January 30, 2012 Good day, prompt, as a module Crosseling insert a brief description of the goods Link to comment Share on other sites More sharing options...
petrovv Posted January 30, 2012 Share Posted January 30, 2012 Good day, prompt,asamoduleCrosselinginserta brief descriptionof the goods you want a short text instead of the long? Link to comment Share on other sites More sharing options...
senior426 Posted January 30, 2012 Author Share Posted January 30, 2012 can be long and Link to comment Share on other sites More sharing options...
petrovv Posted January 30, 2012 Share Posted January 30, 2012 what exactly would you want to ask ...... some more details... Link to comment Share on other sites More sharing options...
senior426 Posted January 30, 2012 Author Share Posted January 30, 2012 displays only the product name and price, you must have a description of the goods Link to comment Share on other sites More sharing options...
petrovv Posted January 30, 2012 Share Posted January 30, 2012 is the default module prestashop? than in template (.tpl) {$orderProduct.description_short} //small text //or {$orderProduct.description}//long text //or {$orderProduct.description|truncate:35:'..'|escape:'htmlall':'UTF-8'} //long text with truncate Link to comment Share on other sites More sharing options...
senior426 Posted January 30, 2012 Author Share Posted January 30, 2012 original crosseling.tpl {if isset($orderProducts) && count($orderProducts)} <div class="products_block accessories_block" id="idTab16"> <h6>{l s='Customers who bought this product also bought:' mod='crossselling'}</h6> <ul> {foreach from=$orderProducts item='orderProduct' name=orderProduct} <li> <a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}"> {assign var='myImage' value=$orderProduct.product_id|cat:'-'|cat:$orderProduct.id_image} <img src="{$link->getImageLink($orderProduct.link_rewrite, $myImage, 'large')}" alt="{$orderProduct.name|htmlspecialchars}" /> </a> <h5> <a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}"> {$orderProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'} </a> </h5> <p class="pprice"> {if $crossDisplayPrice AND $orderProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} <span>{convertPrice price=$orderProduct.displayed_price}</span> {/if} <a title="{l s='КУПИТЬ' mod='crossselling'}" href="{$orderProduct.link}">{l s='More' mod='crossselling'}</a><br /> </p> </li> {/foreach} </ul> </div> {/if} Link to comment Share on other sites More sharing options...
petrovv Posted January 30, 2012 Share Posted January 30, 2012 {if isset($orderProducts) && count($orderProducts)} <div class="products_block accessories_block" id="idTab16"> <h6>{l s='Customers who bought this product also bought:' mod='crossselling'}</h6> <ul> {foreach from=$orderProducts item='orderProduct' name=orderProduct} <li> <a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}"> {assign var='myImage' value=$orderProduct.product_id|cat:'-'|cat:$orderProduct.id_image} <img src="{$link->getImageLink($orderProduct.link_rewrite, $myImage, 'large')}" alt="{$orderProduct.name|htmlspecialchars}" /> </a> <h5> <a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}"> {$orderProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'} </a> </h5> /////////////////////////////////////////////// description include//////////////////////////// <p>// or <h5> {$orderProduct.description_short} </p> /////////////////////////////////////////////// description //////////////////////////// <p class="pprice"> {if $crossDisplayPrice AND $orderProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} <span>{convertPrice price=$orderProduct.displayed_price}</span> {/if} <a title="{l s='КУПИТЬ' mod='crossselling'}" href="{$orderProduct.link}">{l s='More' mod='crossselling'}</a><br /> </p> </li> {/foreach} </ul> </div> {/if} The layout you must arrange yourself with css Link to comment Share on other sites More sharing options...
senior426 Posted January 30, 2012 Author Share Posted January 30, 2012 {$orderProduct.description_short} not working crosseling.php if (!defined('_CAN_LOAD_FILES_')) exit; class CrossSelling extends Module { private $_html; public function __construct() { $this->name = 'crossselling'; $this->tab = 'front_office_features'; $this->version = 0.1; $this->author = 'PrestaShop'; $this->need_instance = 0; parent::__construct(); $this->displayName = $this->l('Cross Selling'); $this->description = $this->l('Customers who bought this product also bought:'); if (!$this->isRegisteredInHook('header')) $this->registerHook('header'); } public function install() { if (!parent::install() OR !$this->registerHook('productFooter') OR !$this->registerHook('header') OR !Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', 0)) return false; return true; } public function uninstall() { if (!parent::uninstall() OR !Configuration::deleteByName('CROSSSELLING_DISPLAY_PRICE')) return false; return true; } public function getContent() { $this->_html = ''; if (Tools::isSubmit('submitCross') AND Tools::getValue('displayPrice') != 0 AND Tools::getValue('displayPrice') != 1) $this->_html .= $this->displayError('Invalid displayPrice'); elseif (Tools::isSubmit('submitCross')) { Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', (int)Tools::getValue('displayPrice')); $this->_html .= $this->displayConfirmation($this->l('Settings updated successfully')); } $this->_html .= ' <form action="'.$_SERVER['REQUEST_URI'].'" method="post"> <fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend> <label>'.$this->l('Display price on products').'</label> <div class="margin-form"> <input type="radio" name="displayPrice" id="display_on" value="1" '.(Configuration::get('CROSSSELLING_DISPLAY_PRICE') ? 'checked="checked" ' : '').'/> <label class="t" for="display_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label> <input type="radio" name="displayPrice" id="display_off" value="0" '.(!Configuration::get('CROSSSELLING_DISPLAY_PRICE') ? 'checked="checked" ' : '').'/> <label class="t" for="display_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label> <p class="clear">'.$this->l('Show the price on the products in the block.').'</p> </div> <center><input type="submit" name="submitCross" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $this->_html; } public function hookHeader() { Tools::addCSS(($this->_path).'crossselling.css', 'all'); } /** * Returns module content for left column */ public function hookProductFooter($params) { global $smarty, $cookie, $link; $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT o.id_order FROM '._DB_PREFIX_.'orders o LEFT JOIN '._DB_PREFIX_.'order_detail od ON (od.id_order = o.id_order) WHERE o.valid = 1 AND od.product_id = '.(int)$params['product']->id); if (sizeof($orders)) { $list = ''; foreach ($orders AS $order) $list .= (int)$order['id_order'].','; $list = rtrim($list, ','); $orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13 FROM '._DB_PREFIX_.'order_detail od LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)($cookie->id_lang).' AND cl.id_lang = '.(int)($cookie->id_lang).' AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1 ORDER BY RAND() LIMIT 10'); $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { $orderProduct['image'] = $link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium'); $orderProduct['link'] = $link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND $taxCalc == 1) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } $smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); } } $orderProduct.description_short not defined $orderProduct['image'] = $link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium'); $orderProduct['link'] = $link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); Link to comment Share on other sites More sharing options...
senior426 Posted January 30, 2012 Author Share Posted January 30, 2012 SOLVED $orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13, pl.description_short FROM '._DB_PREFIX_.'order_detail od LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)($cookie->id_lang).' AND cl.id_lang = '.(int)($cookie->id_lang).' AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1 ORDER BY RAND() LIMIT 10'); 3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now