Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 22 2018 09:05
    @matks banned @Kamelia2000
Kert
@kertli
and what about database
onklmaps
@onklmaps
@piotrpog make sure the module dir is named “ps_emailalerts” and not “ps_emailalerts123”. Downloading from GitHub sometimes add release number to the dirname..
onklmaps
@onklmaps
Screenshot 2019-09-20 08.41.42.png
@matks I am not familiar with how new style lists are made in PS, but it looks like the Category position col has some wrong defininition being a search/filter-field and not a “Push button to activate drag-and-drop-positioning”.
@matks if you understand 😏
onklmaps
@onklmaps
I’m pulling my hair on an issue.. I am trying to add $id_order to the invoice pdf. I could use {$HOOK_DISPLAY_PDF} but I don’t like the position, so 1. I tried to find other hooks to edit PDF content before they are rendered (no luck). Then I tried to add a new hook displayPDFHeaderRight and was able to put content there. However, I am not able to get access to the $id_order at this custom hook.
  1. Are there any way to (with a hook) modify the assigned smarty vars that are sent to a pdf? Specifically I would want to edit the {$title} variable that is visible in header.tpl
  2. If not, is it possible to add a custom hook to header.tpl AND pass id_order into it?
  3. Is the PDF-system to be replaced anytime soon?
Mathieu Ferment
@matks
@piotrpog make sure that the zip filename matches the main php file filename
oh, I see onklmaps has already answered this one :smile: thanks !
Mathieu Ferment
@matks
@onklmaps mmmm I've never looked the internal behavior of PDFs but let's see ...
apparently it uses a hook with dynamic name
if you edit the DeliverySlip PDF then, the right hook to use is displayHTMLTemplateDeliverySlip apparently
  1. : please give it a try :wink:
  2. : if indeed there is not enough hooking capabilities in PDF, then yes we should add the missing hooks (you can open a "feature request" github issue for this)
  3. I dont think so, nothing related to PDF in the roadmap so far
onklmaps
@onklmaps
@matks Where did you find displayHTMLTemplateDeliverySlip?
Hook::exec($hook_name, ...)
and hook name is created dynamically from the class name (see code)
onklmaps
@onklmaps
@matks Oh.. I thought you have found another hook for me, but I have allready had good use from displayPDFDeliverySlip (not displayHTMLTemplateDeliverySlip btw)
renothing
@renothing
how generate prestashop database stracture and relationship documents ?
Kert
@kertli
Hey, is there a link where prestashop version support/roadmap is shown at?
security updates etc
Mathieu Ferment
@matks
@kertli no such things as far as i know
I'd say the best way to track releases timeline would be
what is your need, behind the question ?
Kert
@kertli
@matks i understand the maintenance for 1.6 has dropped in june but does it still have security updates?
@matks and can i ask another question? Are there any guidelines to extend existing models ( product, category, etc ) if i would like to make changes and publish my module in addons. Overrides are nuts and as far as i can see they should be removed
Mathieu Ferment
@matks

the answer is yes and no :smile:
official maintenance of 1.6 has ended, so PrestaShop (the company) will not release new security releases

however for different reasons*, some merchants are still stuck on 1.6
because of this, a community-driven 1.6 repository has been opened https://github.com/PrestaShop/PrestaShop-1.6
some community contributors (so not the company, but developers who have contributed to the project) manage this repo and will release security patches if a vulnerability is found

you can read the full statement here: http://build.prestashop.com/news/1.6.1.x-what-s-next/

*Reasons for being stuck in 1.6 usually involve people having customized the core php files of the code, rendering the upgrade process impossible
They have 1st to revert these changes while keeping the features they created enabled
Then they can migrate

If you are in a similar situation, this will help you :wink:
Basically you are still covered against emergency vulnerabilities, but it's really time to migrate :smile: to PS 1.7

For the 2nd question: yes, you are right overrides are a very bad idea
Powerful but can break the shop very easily
The right way to extend models is to create your own database tables and link them with prestashop core model using foreign keys :wink:
So let's say you want to add extra columns to Order model
Then create your own extra_order.sql table, and use a order_id foreign key to link it
You can choose, to manage this new model, the way you want:
  • it can be raw SQL queries
  • you can create your own ObjectModel
  • you can use DoctrineORM
Florentin Garnier
@FlorentinGarnier
Hello a hook is available for listen when we are on a specific page like cart for exemple, to avoid an override on CartController ?
Mathieu Ferment
@matks

@FlorentinGarnier there are multiple hooks like this :wink: it will depend where you want to be hooked
after the init ? after the controller has been called ?

for example actionFrontControllerAfterInit could be used for you

Florentin Garnier
@FlorentinGarnier
Ok thanks ;)
onklmaps
@onklmaps
@matks Hi Mathieu :) HelperOptions, HelperList, HelperForm - do they belong to the past? I guess I can’t use such (lovely) things in modern module admin controllers? Or are they reborn to something even better?
Kert
@kertli

@matks Yes, i know couple of merchants who are in the same position with 1.6 - that was the main reason :) Also what are the future thoughts about extending models, is it going to change or get better by any means?

Thanks for you time

Mathieu Ferment
@matks

@onklmaps unfortunately yes, these classes will be gone
I know they are quite useful but they actually are not a good implementation as they return raw HTML or javascript
and consequently they violate the vue/controller separation for a proper MVC framework

When eligible, we'll replace them by something modern that provide equivalent features :smile:

@kertli if you use extra tables and associations this looks quite alright to me, isn't it ?
by "get better" you think about built-in functions like addColumn() or addFields() that modules could use ?
Kert
@kertli
@matks i thought about it and yes, it's alright when using references and different hooks. I don't even know whati meant by "better". It feels like it's a hazzle and could improve at some point. Registering your modules table so that Model can access it and add fields automatically for example
Mathieu Ferment
@matks

it would be nice but we'll need to be extra cautious

the main issue is when 2 modules are installed on the same shop and both want to extend the same model
at this moment, things get tricky :sob: it's hard to perform such advanced feature like addColumn() and be sure we break nothing

Kert
@kertli
yes, i can see the problem.. will try out the reference and hook method :smile:
stefanovita
@stefanovita
Hello, i would like to use the hook action<FormName>FormBuilderModifier but it seems it's not working for the product page. Any idea why?
Mathieu Ferment
@matks
@stefanovita yes ... :disappointed: the Product page has been migrated a long time ago so it does not follow the same system
you need to use the hook dedicated to the Product page
wtr lgw
@WLagauw_twitter
Hi, sometimes on an object model, there is a field id_shop on the lang table sometimes there is no id_shop. Than there is a object_shop table. I understand that it’s purpose is multistore, but why there is not always an id_shop on the object_lang?
stefanovita
@stefanovita

@stefanovita yes ... :disappointed: the Product page has been migrated a long time ago so it does not follow the same system
you need to use the hook dedicated to the Product page

We need to change the validation rules for a specific field, which is the hook to use? E.g. i would like to use also alphanumeric chars in upc, so i need to chnage the validation rules for that field. Which is the hook that cna be used to change formBuilder for product page?

Also, if there is no hook, do you have a working example of service decoration?
Pablo Borowicz
@eternoendless
I think that alphanumeric UPC codes may be nonstandard
stefanovita
@stefanovita
@eternoendless They absolutely are non standard, but we migrating an old shop that used upc to store "something else". We can manage this with an additional field but we had the idea to find ways to change standard behaviours, using hooks or service decorations.
So the matter is not upc, but find the good way to override the product page with the new services
onklmaps
@onklmaps

@matks

When eligible, we'll replace them by something modern that provide equivalent features :smile:

What is currently the best example of a native module using modern controller(s) to show some simple config options and a listing? Would be great to look at fore reference on how I can do things :smile: