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
kvokul
@kvokul
@matks Thank you. We'll try to rewrite our new module that way, and be back with new question ;) I think, that we could have problems with uploading files depending on _lang in admin controller with helper, but we will try.
Mathieu Ferment
@matks
interesting
indeed there might be issues (uploading file with multilang looks like a nice candidate for issues :sweat_smile: ) but we can try to solve it together
and improve both documentation and software to solve it in an easier way for future :muscle:
Mickaël Fernandez
@micka-fdz
Hello. What's the current way to delete space before currency symbol?
Mathieu Ferment
@matks
@micka-fdz if you want to modify how a currency is displayed, in 1.7.6 it cannot be done from the BO (it will be possible in 1.7.7) so you need to modify the source config file
in localization/CLDR/core
in this folder we put the CLDR files which define the currency display format
Mickaël Fernandez
@micka-fdz
Yes, I know that it will be possible in 1.7.7.
Mathieu Ferment
@matks
also, the content of these xml file is put in a caching layer for performance, so you'll need to clear the cache afterwards :wink:
Mickaël Fernandez
@micka-fdz
in localization/CLDR/core/common/main ?
I'm in 1.7.6.2
Mathieu Ferment
@matks
yes
in localization/CLDR/core/common/main
you need to find the right file for your locale config (language + country)
Mickaël Fernandez
@micka-fdz
ok so fr_FR.xml
but my file is very short and I don't see this info
Mathieu Ferment
@matks
the naming convention is overly complexed :cry: but it comes from a standard
you need to dig in
check fr.xml

in fr.xml I think there is

        <currencyFormats numberSystem="latn">
            <currencyFormatLength>
                <currencyFormat type="standard">
                    <pattern>#,##0.00 ¤</pattern>
                </currencyFormat>
                <currencyFormat type="accounting">
                    <pattern>#,##0.00 ¤;(#,##0.00 ¤)</pattern>
                </currencyFormat>
            </currencyFormatLength>

looks like a nice candidate
the best is to try :smile: add something easy to spot like a AAA in front, clear cache, check how it looks on FO

Mickaël Fernandez
@micka-fdz
no there isn't currencyFormats section in my fr.xml file
Mathieu Ferment
@matks
?
strange
I have one
they might have changed between 176 and 177
I setup a 176 shop and I tell you
Mickaël Fernandez
@micka-fdz
my bad, I got it !
Mathieu Ferment
@matks
ah, nice :smile:
so as we can guess ¤ must be the symbol
removing the space in front of it, then clearing cache, must do the job
Mickaël Fernandez
@micka-fdz
it works perfectly, thanks!
it's easier when you know where to look
Mathieu Ferment
@matks
indeed :smile:
Joshua Bemenderfer
@com.creation.jbemenderfer_gitlab
@matks Awhile back I asked about allowing a Symfony (FrameworkBundleAdminController) to be accessed from other sites using CORS requests. You recommended $allowAnonymous, but that seems to still require a token. Other sites aren't able to generate a valid token, so it does little good. I basically need to expose one action without a token. Will it be necessary to create a non-symfony front controller?
kvokul
@kvokul

Hi. Next question:

You recommend to stop using ObjectModel. At the same time, documentation encourage to use the Hook class. The Hook class is an extension of the ObjectModel class, so it can be deprecated soon.

What should you use instead of Hook?

Mathieu Ferment
@matks

By "stop using ObjectModel", I meant "if you want to create new database-persisted objects"
sorry for the confusion :sweat_smile:

using already-existing objects of PrestaShop that rely on ObjectModel is fine
what we want to avoid is people creating shops with customization that rely on ObjectModel for database persistence matters

kvokul
@kvokul
OK. Thanks ;)
Robertino Vasilescu
@Rho-bur
Hi @mickaelandrieu is the friends-of-presta/developer_tools still maintained? Itried to give it a try but the composer install failed with https://i.imgur.com/YEyTBM0.png and the regular way also fails with a vendor/autoload.php not found error. PS 1.7.6.3
Mathieu Ferment
@matks
@Rho-bur Mickael Andrieu does not come here a lot :smile: so in order to reach him, the best way is to open an issue on the github repository with the question (and ping him)
Robertino Vasilescu
@Rho-bur
@matks thank you, I will! Good night! :-)
Robertino Vasilescu
@Rho-bur
Hello! can anyone point to an example of adding module tabs in BO using the TabRepository? The usual way warn of deprecation but even the devdocs or PS modules are still using it...
onklmaps
@onklmaps
@matks Any plans to replace the pdf-system in prestashop soon? The emails looks so much better now, just waiting for a better PDF-system ;-)
Like dompdf or similar - so PDFs can be created and edited with twig
8ternity
@8ternity

I have a question for Smarty Page Heading customisation. I want to hide the <h1> heading name into CMS page. Not into Categories for products. How can we acheive that with Smarty?

{block name='content'}
<section id="main">
{block name='page_header_container'}
{block name='page_title' hide}
<h1 class="page-heading">{$smarty.block.child}</h1>
{/block}
{/block}

kvokul
@kvokul

Hi. Next question:

When I asked about Doctrine, you gave me example: https://github.com/friends-of-presta/demo-cqrs-hooks-usage-module

But, when I try to use this, a saw this (demo-cqrs-hooks-usage-module/src/Entity/Reviewer.php):

namespace DemoCQRSHooksUsage\Entity;
use PrestaShop\PrestaShop\Adapter\Entity\ObjectModel;
class Reviewer extends ObjectModel
{
...
}

As I understand, your module, use as example of "not using ObjectModel" extends ObjectModel... And, have ObjectModel class in place (by your documentation) reserved for Entity resource. Can I ask you of another example, please?

Your documentation about presta-doctrine is little different than original doctrine docs, and we REALLY want to do module in new way, specially, if you want to disable ObjectModule in future. Without working example, and strange documentation it could be very tough.

Rhythm
@rhythminmyhead_twitter
Hi, I need to return JSON from my controller.
I tried this: use Symfony\Component\HttpFoundation\JsonResponse; and paired it with: return new JsonResponse([ 'result' => 'ok' ]);
However, my page breaks and it says $template variable is missing. I am not trying to render anything, input goes through postProcess()
Robertino Vasilescu
@Rho-bur
Hi,
I am trying to build a form using the CategoryChoiceTreeType which requires a categoryTreeChoices array; I tried all methods from the Category PrestaShop\Adapter\Entity\Category and all I can get is a list of categories like https://i.imgur.com/J1MQ0I6.png but what I need is a tree like in docs https://i.imgur.com/WrohuWN.png.
Any pointer please, an example of the sort?
Robertino Vasilescu
@Rho-bur
By example I mean a small array so I can get the right format, tried with ["id_category" => 2, "name" => "Home", "children" => $this->getSubCategories(1, true, 2)] but no luck :-(
Robertino Vasilescu
@Rho-bur
I am 90% sure my array is conform to the docs however no tree expanding for children...
kvokul
@kvokul

And next few question::

1.
Example: I can have SimpleObject class, it means, thet i need ps_simple_object table (by your documentation). And I must created by "install.php" in sql folder. Assuming that my _DBPREFIX is "ps_". Is that right?

2.
This class need have: namespace DarkSidePro\DarkBlog\Entity; - assuming that my company is DarkSide, and module name is DarkBlog.
Is that right?

3a
How works your doctrine with _lang and _shop table?

In Object-relational mapping one logical object could be interpreted as several table, as in your ObjectModel class. But there is no single word in whole documentation how works your interpretation of doctrine.

In my example I have ps_simple_class, and ps_simple_class_lang - for content, and ps_simple_class_shop for relation with chop categories. As I understand - this is still true, and you dont chage that system? It is right?

3b.
How I should declare my Entity class with _lang, and _shop table?

In ObjectModel _lang table operation were automatically included in all needed table. But there was the way to give system information that a specific field is stored in _lang table.

As I mentioned before - your example of using entity use ObjectModel - so it gives no information about it.

We need specific information on how to write code, that use _lang, and _shop table.

Thank you in advance ;)

kvokul
@kvokul

BTW: anticipating the answer "Look at 'the ProductComments module' in documentation example" I must note, that:

in that example the only using _lang class ProductsCommentCriterion (/scr/Entity/ProductCommentCriterion.php)
is duplicated in ObjectModule (main catalog ProductCommentCriterion.php),

It is anti-pattern itself, and (as a bonus) with errors, with an error rendering validation impossible. I dont even tell about of poor quality of the code, which we are used to .

Sorry - we spend three weeks, on module, which is copy of our symfony application. Aplication take us two days, and worked perfectly. Whay it is impossible in PrestaShop in three weeks???

Robertino Vasilescu
@Rho-bur
I am somehow in a similar state of mind as @kvokul ; I work with PS from 2009 and the docs were always terrible but especially now in these times of change this matters a lot. I see that they are on a way of improving but still lags behind. Even worse, the "modern" modules PS developed are not following the PS own recommendations so basically we are left to a guess work mostly. What we need guys is that we have at least two reference modules a BO one and and FO one both 100% complying with and using the modern ways. I am fond of PS which I consider the best choice in regards to costs/results but its spread with developers is seriously limited by the lack of docs or at least some complete functional example modules implementing the Symfony ways.