Last active
June 4, 2018 02:31
-
-
Save IsaiChristian/ab14c226b58862dc161e5858e66f1397 to your computer and use it in GitHub Desktop.
Extender AdminProduct #ps1.7 #backend #product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7** in src/PrestaShopBundle/Model/Product/AdminModelAdapter.php*/ | |
$this->translatableKeys = array( | |
'name', | |
'description', | |
'description_short', | |
'frais_a_prevoir', | |
'link_rewrite', | |
'meta_title', | |
'meta_description', | |
'available_now', | |
'available_later', | |
'tags', | |
); | |
//define unused key for manual binding | |
$this->unmapKeys = array('name', | |
'description', | |
'description_short', | |
'frais_a_prevoir', | |
'images', | |
'related_products', | |
'categories', | |
'suppliers', | |
'display_options', | |
'features', | |
'specific_price', | |
'virtual_product', | |
'attachment_product', | |
); | |
/** and */ | |
'frais_a_prevoir' => $this->product->frais_a_prevoir, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
IN : src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig | |
--> | |
<ul class="nav nav-tabs bordered"> | |
<li id="tab_description_short" class="nav-item"><a href="#description_short" data-toggle="tab" class="nav-link description-tab active">{{ 'Summary'|trans({}, 'Admin.Catalog.Feature') }}</a></li> | |
<li id="tab_description" class="nav-item"><a href="#description" data-toggle="tab" class="nav-link description-tab">{{ 'Description'|trans({}, 'Admin.Global') }}</a></li> | |
<li id="tab_frais_a_prevoir" class="nav-item"><a href="#frais_a_prevoir" data-toggle="tab" class="nav-link description-tab">{{ 'frais_a_prevoir'|trans({}, 'Admin.Global') }}</a></li> | |
</ul> | |
<div class="tab-content bordered"> | |
<div class="tab-pane panel panel-default active" id="description_short"> | |
{{ form_widget(form.step1.description_short) }} | |
</div> | |
<div class="tab-pane panel panel-default " id="description"> | |
{{ form_widget(form.step1.description) }} | |
</div> | |
<div class="tab-pane panel panel-default " id="frais_a_prevoir"> | |
{{ form_widget(form.step1.frais_a_prevoir) }} | |
</div> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
IN : classes/Product.php | |
The extra field is : frais_a_prevoir | |
In class /classes/Product.php 3 modifications | |
*/ | |
1) | |
*/ | |
/** @var string Frais à prévoir */ | |
public $frais_a_prevoir; | |
/** | |
2) | |
*/ | |
'frais_a_prevoir' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isCleanHtml'), | |
/** | |
3) | |
*/ | |
$sql->select( | |
'p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`coldescription`, pl.`link_rewrite`, pl.`meta_description`, | |
pl.`meta_keywords`, pl.`meta_title`, pl.`name`, pl.`available_now`, pl.`available_later`, image_shop.`id_image` id_image, il.`legend`, m.`name` AS manufacturer_name, | |
(DATEDIFF(product_shop.`date_add`, | |
DATE_SUB( | |
"'.$now.'", | |
INTERVAL '.$nb_days_new_product.' DAY | |
) | |
) > 0) as new' | |
); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
/src/PrestaShopBundle/Form/Admin/Product/productInformation.php | |
*/ | |
->add('frais_a_prevoir', 'PrestaShopBundle\Form\Admin\Type\TranslateType', array( | |
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextareaType', | |
'options' => [ | |
'attr' => array('class' => 'autoload_rte'), | |
'required' => false | |
], | |
'locales' => $this->locales, | |
'hideTabs' => true, | |
'label' => $this->translator->trans('frais_a_prevoir', [], 'Admin.Global'), | |
'required' => false | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment