How can i remove and rename items from "Sort by" in prestashop? - prestashop

I am new to Prestashop and I am trying to remove from "Sort by" dropdown the default options: "Name, A to Z" and "Name, Z to A". Also i am trying to rename the option: "Relevance".
I tried to change these values from dashboard, but unfortunately i couldn't.
Does anyone know how can i fix it?
Thank you in advance.

Hi #opnash and welcome to SO,
Solution to Edit these entries
You can edit these via the International > Translations tab in your PrestaShop admin panel:
You can then select Themes translations, your theme, your language and hit Modify:
Then, you can either select Theme > Catalog in the sidebar or search for "Name, Z to A" (for instance):
Lastly, just edit the text in the text box and hit Save and VoilĂ !
Solution to Remove these entries
Now, to delete some of these, the process would be different, you could either:
Override the SortOrder() class (in PrestaShop\PrestaShop\Core\Product\Search) and filter the allowed criteria and also override the getDefaultSortOrders() in the SortOrderFactory class
-or-
Edit all the files where these Sort criteria are defined, example:
modules\ps_facetedsearch\src\Ps_FacetedsearchProductSearchProvider.php
Line 127: $this->module->getTranslator()->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
src\Adapter\BestSales\BestSalesProductSearchProvider.php
Line 102: $this->translator->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
src\Adapter\NewProducts\NewProductsProductSearchProvider.php
Line 113: $this->translator->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
src\Adapter\PricesDrop\PricesDropProductSearchProvider.php
Line 107: $this->translator->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
Please note that you can also configure the default sort criteria in your Admin Panel, via Shop Parameters > Product Settings:
I hope this helps!

Related

How can we export translatable fields content in Odoo?

In Odoo (16), I would like to export all my translatable fields content to a file so I can easily edit it and translate to new languages.
I already know how to edit one by one, in the screen, but for what is a growing set of data it will take more time that translate it using a proper program (example: PoEdit).
Here is part of my model definition
class Card(models.Model):
_name = "carddecks.card"
_description = "Card"
cardText = fields.Char("Card Text", required=True, translate=True)
And now I can also see the language icon in the Card form, so I can edit it there.
How do I manage to export a po file with all the content?
All I can get from Settings -> Translations -> Export Translation is a set of field labels. Not field content...
Any ideas on how to accomplish this?
In debug mode via Technical Settings there should be a menu item named Translated Terms

How to add Price field to Odoo Product template?

I am using this free Odoo data slider module on website.
https://www.odoo.com/apps/modules/9.0/website_snippet_data_slider/
A nice module and works well too.I need to add "price" field in to this as currently it displays product name only.
Accordingly to this module we can add fields to slider from product.template to this section
https://github.com/laslabs/odoo-website/blob/9.0/website_snippet_data_slider/static/src/js/data_slider.js#L131
have tried to add price field like this
this.priceField = this.widgetOptions.data_price_field;
this.fields = [this.priceField, 'lst_price'];
unfortunate it doesn't work.Can anyone point me the reason and fix?
Thanks
Basically you need to map the value of the price to an html element. I have not tested this however if you take a look at data_slider.js just follow what is done for the display_name (product name data_name_field) from top to bottom.
You will also want to do some formatting for currency and so on. This should get you going in the right direction. Good luck!
In data_slider.js try making the following changes.
Below line 27 add:
data_price_field: 'price',
Below line 125 add:
this.priceField = this.widgetOptions.data_price_field;
Replace line 131 with:
this.fields = [this.nameField, this.priceField, 'id'];
Below line 96 add:
var $price = $('<h5>').text("Price " + record[this.fields[1]]);
Replace line 97 with:
var $caption = $('<div class="caption">').append($title).append($price);

How to disable Intellij wrapping on # in match statements in Scala?

Intellij formats the following match statement
case product # Product(id, name) =>
....
to
case product#Product(id, name) =>
....
How do I disable the wrapping ? The wrapping makes it harder to read the code where are too many cases.
I am assuming, you are using IDEA 15.
Go to Preferences
In the left panel, select Editor > Code Style > Scala
Select the 'Spaces' tab
Scroll down in the checkbox list
Check Spaces around '#' in pattern bindings

Drupal 7 - Print PDF and Panelizer

Hi guys ,
I'm currently working on a Drupal project which use the Panelizer module by overriding the default node display. The panel for this content type is made width a lot of rules and specifications in order to display some specific content (like views) according some fields.
Now I need to print in PDF the same content that is displayed by the panelizer module but in another display (in one column ), so I cloned the display I use and rearranged it to display what I want.Then I want to use this display width the print module but I didn't managed to do that.
Any idea how can I do that ?
I just can't use the default node render, because I would miss some informations dues to the specifications used in the panel, and I can't print the panelized content because it's not the same display.
I read this thread but how can I say to the print module to use the "print" display I cloned instead of the default one ?
Any suggestions or ideas will be appreciated or if you have another idea for doing that you're welcome :)
Thank you !
In your print pdf template you can load the node then create a view with the display and finally render it : drupal_render(node_view(node_load($node->nid), "name of your display")) ;
Another way is to alter node entity info, telling that 'print' view can be panelized, i.e.
/**
* Implements hook_entity_info_alter().
*/
function mymodule_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['print']['custom settings'] = TRUE;
...
}
After that, you go to panelizer settings of your content type(s), and set whatever you want for the print view mode

Fixed text when scrolling

My program displays an ABAP list, I'm trying to show a header (some lines of text, nothing fancy) fixed when scrolling down in a report.
Is there some kind of tag or declaration that I have to use?
In SE38 you can define list heading with 'GOTO -> Text Elements -> List Headings`.
You can define a list header, and titles for your list (Columns heading).
One advantage: With GOTO -> Translations you can define different texts in different languages.
Another way to get this maintenance screen:
From your list, you can choose: System -> List -> List Header.
Another way:
You can use top-of-page to define your header text inside your report code.
top-of-page.
write 'My header'.
You can use the TOP OF PAGE event to write something that will stick at the top of the page while scrolling. You can find more info here.
You can also use the list headers from Text Elements menu. More info here.
Best regards,
Sergiu
One way is directly using top-of-page in your code.
Other way is calling reuse_alv_grid_display or reuse_alv_list_display (depending on your output type) and declaring "top-of-page" in the I_CALLBACK_TOP_OF_PAGE line. Then create a sub-routine with the same name as your "top-of-page". In that you can write
wa_list-typ = 'H'.
wa_list-info = ''.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'A'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
OR
wa_list-typ = 'S'.
wa_list-info = 'Report Header'.
APPEND wa_list to it_list.
clear wa_list.
depending on what you want (header, action or selection).
Finally you can use REUSE_ALV_COMMENTARY_WRITE function and call the table(in this example it_list).
Hope it helped.