Roman0002 Posted October 13, 2014 Share Posted October 13, 2014 Hello, I would like to have address of the supplier in the description of the product .... How do I do I tried to rewrite SupplierController.php and then insert this code {$ supplier_address-> address1 | escape: 'htmlall': 'UTF-8'} to product.tpl But it does not work ... Pls help me ... Thank you in advance for the answers. I use prestashop 1.6 Link to comment Share on other sites More sharing options...
PascalVG Posted October 13, 2014 Share Posted October 13, 2014 Try instead in file : controllers/front/ProductController.php (Make backup!!!) (Sample code from 1.6.0.5) in function : public function initContent() Find below black code and add red code: (easy to find when you search for PS_STOCK_MANAGEMENT (Ctrl-F) ) ... if (isset($this->product->id_supplier)) { $supplier_address_id= Address::getAddressIdBySupplierId($this->product->id_supplier); if (isset($supplier_address_id)) $supplier_address = new Address($supplier_address_id); } $this->context->smarty->assign(array( 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id), 'supplier_address' => $supplier_address, 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), ... and save (Did you make backup first?) Then go to themes/<your theme folder>/product.tpl: (Make backup!!!) Find black code and add red code: {if $product->description} <!-- More info --> <section class="page-product-box"> <h3 class="page-product-heading">{l s='More info'}</h3>{/if} {if isset($product) && $product->description} <!-- full description --> <span class="supplier_address_prod_page">{if isset($supplier_address)}{$supplier_address->address1}{/if}</span><div class="rte">{$product->description}</div> </section> <!--end More info --> {/if} Save and try. Make sure you add some address1 field info to see it :-) Hope this helps, pascal. 1 Link to comment Share on other sites More sharing options...
Roman0002 Posted October 13, 2014 Author Share Posted October 13, 2014 Try instead in file : controllers/front/ProductController.php (Make backup!!!) (Sample code from 1.6.0.5) in function : public function initContent() Find below black code and add red code: (easy to find when you search for PS_STOCK_MANAGEMENT (Ctrl-F) ) ... if (isset($this->product->id_supplier)) { $supplier_address_id= Address::getAddressIdBySupplierId($this->product->id_supplier); if (isset($supplier_address_id)) $supplier_address = new Address($supplier_address_id); } $this->context->smarty->assign(array( 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id), 'supplier_address' => $supplier_address, 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), ... and save (Did you make backup first?) Then go to themes/<your theme folder>/product.tpl: (Make backup!!!) Find black code and add red code: {if $product->description} <!-- More info --> <section class="page-product-box"> <h3 class="page-product-heading">{l s='More info'}</h3>{/if} {if isset($product) && $product->description} <!-- full description --> <span class="supplier_address_prod_page">{if isset($supplier_address)}{$supplier_address->address1}{/if}</span><div class="rte">{$product->description}</div> </section> <!--end More info --> {/if} Save and try. Make sure you add some address1 field info to see it :-) Hope this helps, pascal. Yes its working.... But i want all description of supplier not only adress i want telephone number, company name, city .... all description of supplier Thank you Link to comment Share on other sites More sharing options...
PascalVG Posted October 13, 2014 Share Posted October 13, 2014 OK, to get detaild from the supplier itself, add the blue lines in the same file as mentioned above : controllers/front/ProductController.php (Make backup!!!) ... if (isset($this->product->id_supplier)) { $supplier = new Supplier($this->product->id_supplier); $supplier_address_id= Address::getAddressIdBySupplierId($this->product->id_supplier); if (isset($supplier_address_id)) $supplier_address = new Address($supplier_address_id); } $this->context->smarty->assign(array( 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false, 'accessories' => $this->product->getAccessories($this->context->language->id), 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id), 'supplier' => $supplier, 'supplier_address' => $supplier_address, 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => (($this->product->cache_has_attachments) ? $this->product->getAttachments($this- ... Just add some more in the tpl file from above: themes/<your theme folder>/product.tpl: {if $product->description} <!-- More info --> <section class="page-product-box"> <h3 class="page-product-heading">{l s='More info'}</h3>{/if} {if isset($product) && $product->description} <!-- full description --> <span class="supplier_address_prod_page"> {if isset($supplier_address)} {l s='Supplier info:'}<br /> {$supplier->name}<br /> {' '|implode:$supplier->description} {$supplier_address->company}<br /> {$supplier_address->vat_number}<br /> {$supplier_address->address1}<br /> {$supplier_address->address2}<br /> {$supplier_address->postcode}<br /> {$supplier_address->city}<br /> {$supplier_address->phone}<br /> {$supplier_address->phone_mobile}<br /> {/if} </span> <div class="rte">{$product->description}</div> </section> <!--end More info --> {/if} Hope that does it, pascal 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