Jump to content

mdusamaansari

Members
  • Posts

    59
  • Joined

  • Last visited

4 Followers

Profile Information

  • Location
    India
  • Activity
    Developer

Recent Profile Visitors

4,174,582 profile views

mdusamaansari's Achievements

Newbie

Newbie (1/14)

3

Reputation

1

Community Answers

  1. I am sorry vekia, its supplier not manufacturer. Suppliers need to be searched. Sorry for this mistake.
  2. Hi Techies, I am using prestashop version 1.5.4.1. I am in need of two columns in orders list in back office to make advanced search. Product reference and manufacturer names are the two columns need to inserted in order list. If product reference or manufacturer names provided for searching, it should provide orders which contains the product or manufacturer names. Please help me in doing this. Its similar to this http://www.prestashop.com/forums/topic/275522-solved-add-backoffice-columns-products-list/ Thanks in advance. Mohammed
  3. Hi Nemos and Vekia, I have done this out. I used a custom hook so $params['products'] values are empty. So i used $products = $params['cart']->getProducts(true); in module php file. So its everything perfect. Thanks for your support.
  4. Hi Nemos and Vekia, Here is my crossselling.php <?php /* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 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/afl-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-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) 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 !$this->registerHook('displayCrossSelling') OR !Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', 0) OR !Configuration::updateValue('CROSSSELLING_NBR', 10)) return false; return true; } public function uninstall() { if (!parent::uninstall() OR !$this->unregisterHook('productFooter') OR !$this->unregisterHook('header') OR !$this->unregisterHook('displayCrossSelling') OR !Configuration::deleteByName('CROSSSELLING_DISPLAY_PRICE') OR !Configuration::deleteByName('CROSSSELLING_NBR')) return false; return true; } public function getContent() { $this->_html = ''; if (Tools::isSubmit('submitCross')) { if (Tools::getValue('displayPrice') != 0 AND Tools::getValue('displayPrice') != 1) $this->_html .= $this->displayError('Invalid displayPrice'); else if (!($productNbr = Tools::getValue('productNbr')) || empty($productNbr)) $this->_html .= $this->displayError('You must fill in the \'Products displayed\' field.'); elseif ((int)($productNbr) == 0) $this->_html .= $this->displayError('Invalid number.'); else { Configuration::updateValue('CROSSSELLING_DISPLAY_PRICE', (int)Tools::getValue('displayPrice')); Configuration::updateValue('CROSSSELLING_NBR', (int)Tools::getValue('productNbr')); $this->_html .= $this->displayConfirmation($this->l('Settings updated successfully')); } } $this->_html .= ' <form action="'.Tools::safeOutput($_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> <div class="margin-form"> <input type="text" name="productNbr" value="'.(int)Configuration::get('CROSSSELLING_NBR').'" /> <p class="clear">'.$this->l('Define the number of products displayed in this block').'</p> </div> <center><input type="submit" name="submitCross" value="'.$this->l('Save').'" class="button" /></center> </fieldset> </form>'; return $this->_html; } public function hookHeader() { $this->context->controller->addCSS(($this->_path).'crossselling.css', 'all'); $this->context->controller->addJS(($this->_path).'js/crossselling.js'); } /** * Returns module content */ public function hookDisplayCrossSelling($params) { /*if (!$params['products']) return;*/ global $smarty, $cookie, $link; $qOrders = '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 ('; $nProducts = count($params['products']); $i = 1; $pIds = array(); foreach ($params['products'] as $product) { $qOrders .= 'od.product_id = '.(int)$product['id_product']; if ($i < $nProducts) $qOrders .= ' OR '; ++$i; $pIds[] = (int)$product['id_product']; } $qOrders .= ')'; $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($qOrders); if (sizeof($orders)) { $list = ''; foreach ($orders AS $order) $list .= (int)$order['id_order'].','; $list = rtrim($list, ','); $list_product_ids = join(',', $pIds); $orderProducts = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, product_shop.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) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = product_shop.id_category_default'.Shop::addSqlRestrictionOnLang('cl').') LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.' AND od.product_id NOT IN ('.$list_product_ids.') AND i.cover = 1 AND product_shop.active = 1 ORDER BY RAND() LIMIT '.(int)Configuration::get('CROSSSELLING_NBR').' '); $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { //my content here $dummy_text = "success"; $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium')); $orderProduct['link'] = $this->context->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); } $this->smarty->assign(array('order' => (count($pIds) > 1 ? true : false), 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), //my content here 'dummy_text' => $dummy_text, 'new_orders' => $orders, 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); } /** * Returns module content for left column */ public function hookProductFooter($params) { $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, product_shop.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) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = product_shop.id_category_default'.Shop::addSqlRestrictionOnLang('cl').') LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.' AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND product_shop.active = 1 ORDER BY RAND() LIMIT '.(int)Configuration::get('CROSSSELLING_NBR').' '); $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], ImageType::getFormatedName('medium')); $orderProduct['link'] = $this->context->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); } $this->smarty->assign(array('order' => false, 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); } } Here is my crossselling.tpl file codes {* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 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/afl-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-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {if isset($orderProducts) && count($orderProducts)} <div id="crossselling"> <script type="text/javascript">var cs_middle = {$middlePosition_crossselling};</script> <h2 class="productscategory_h2">{l s='Customers who bought this product also bought:' mod='crossselling'}</h2> <p>{$new_orders}</p> <p>{$dummy_text}</p> <div id="{if count($orderProducts) > 5}crossselling{else}crossselling_noscroll{/if}"> {if count($orderProducts) > 5}<a id="crossselling_scroll_left" title="{l s='Previous' mod='crossselling'}" href="javascript:{ldelim}{rdelim}">{l s='Previous' mod='crossselling'}</a>{/if} <div id="crossselling_list"> <ul class="clearfix" {if count($orderProducts) > 5}style="width: {math equation="width * nbImages" width=107 nbImages=$orderProducts|@count}px"{/if}> {foreach from=$orderProducts item='orderProduct' name=orderProduct} <li> <a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}" class="lnk_img"><img src="{$orderProduct.image}" alt="{$orderProduct.name|htmlspecialchars}" /></a> <p class="product_name"><a href="{$orderProduct.link}" title="{$orderProduct.name|htmlspecialchars}">{$orderProduct.name|truncate:15:'...'|escape:'htmlall':'UTF-8'}</a></p> {if $crossDisplayPrice AND $orderProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} <span class="price_display"> <span class="price">{convertPrice price=$orderProduct.displayed_price}</span> </span><br /> {else} <br /> {/if} <!-- <a title="{l s='View' mod='crossselling'}" href="{$orderProduct.link}" class="button_small">{l s='View' mod='crossselling'}</a><br /> --> </li> {/foreach} </ul> </div> {if count($orderProducts) > 5}<a id="crossselling_scroll_right" title="{l s='Next' mod='crossselling'}" href="javascript:{ldelim}{rdelim}">{l s='Next' mod='crossselling'}</a>{/if} </div> </div> {/if} Please help me in this issue.
  5. The text "Kunder, der købte denne vare, købte også:" section is the crossselling module div and its a custom hook.
  6. Sorry, now I have uploaded it. Please check it now, I have disabled the hook on product detail page.
  7. Hi Techies, My prestashop Version is 1.5.4.1. I have installed Crossselling with custom hook as displayCrossSelling. My module is working perfect, it showing its tpl file contents, but products are not showing. here is the link http://store.unikmobil.dk/da/quick-order Its working perfect on product page, and its showing products for all products. Please check this and help me for getting products. Thanks in advance.
  8. Hi TimShoper, Really am very much thankful for your support. I fount this is very helpful for me. I am using version 1.5.4.1. I found a small issue that, my qty named input field value is not getting updated when I press "plus" or "minus". So the default value is sending to blockcart. Here is my online link, where you can check it out. http://store.unikmobil.dk/ Thanks in advance.
  9. Hi Techies, I am using PS version 1.5.4.1. I need quantity up and quantity down as in shopping cart page. The quantity up and quantity down is available in 1.6 version. But I need in version 1.5.4.1. Here with attached my requirement as image with circled red. Thanks in advance. mdusamaansari
  10. Hi Techies, I have read a post in nemops.com. Here is the post link http://nemops.com/smart-shopping-cart-for-prestashop/#.U6e_AZSSxLM Go through this post very well, I have used it in my store. Here is link of my demo store. http://store.unikmobil.dk/ Its working perfect. But I have a small issue with it. If a customer adds up the quantity in shopping cart, then the availability status should get changed. The availability status has been displayed by using three different colour images in stock column of shopping cart. The availability status should get changed when quantity get changed. When quantity increases, the availability should changed to "On back order" or "Not available" depends upon the product's quantity available in the store. Thanks in advance.
  11. If the customer have both delivery address and billing address saved in database, then both address to be displayed. If the customer have only one address as delivery address, then delivery address to be displayed. The address to be displayed in one page checkout order-address.tpl file.
  12. Hi Nemo, Actually in one page checkout, both address will get displayed right?. I have made invoice address as hidden. So Invoice address will not get displayed in the checkout page. I need it to be displayed when invoice address is present.
  13. Yes, If they have two different address, we need to display both the address. If not, only one address to be displayed.
×
×
  • Create New...