Jump to content

[SOLVED] Show "On sale" on ALL products in one click


NOLOGIN

Recommended Posts

Hey there,

 

I want to perform a really basic and simple task, in fact I want the "On sale" ribbon to show up on ALL products, I have more than 800 products, I don't want to set this option by opening each product one by one.

There's certainly a quicker way to accomplish this basic task?

Thanks for your help!

 

 

NL.

Edited by NOLOGIN (see edit history)
Link to comment
Share on other sites

 

SOLUTION: On phpMyAdmin, type this on a SQL console after selecting your Prestashop database:

UPDATE ps_product, ps_product_shop SET ps_product.on_sale=1, ps_product_shop.on_sale=1

Hi  NOLOGIC   ,  i m noob in ps  . U know if i  modify the  database  show  an image like ribon in certain combination ?

Thanks

Jon

Link to comment
Share on other sites

Hey there @Belonia,

Can you access your database via phpMyAdmin? Just to make sure we're on the same line: you can't access the database via Prestashop, you can gain access to it from the cPanel of your hoster. When you accessed phpMyAdmin, follow these steps:

 

686789step12.jpg

 

 

 

 

 

 

881482step23jpg.jpg

 

 

 

 

Good luck! :)

Edited by NOLOGIN (see edit history)
Link to comment
Share on other sites

Important update: this might not work correctly with the products marked as "New" that show up on your index page, to correct this, I suggest the following modification: (works like a charm for me)

 

Edit the following file: root/themes/your_theme/product-list.tpl

Find this line:

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

And replace it by this:

{if isset($product.on_sale) && $product.on_sale && $product.on_sale == 1 && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

Basically it will force to look at the "On sale" state to enable the "On sale" ribbon.

 

Also, there seems to be problems with cache, I disabled mine, that's the only solution I've got here since Prestashop is a lot more faster without the cache function for me (even though I've got 1500 products). If someone got better solution, go ahead.

 

 

 

NL.

Edited by NOLOGIN (see edit history)
Link to comment
Share on other sites

Important update: this might not work correctly with the products marked as "New" that show up on your index page, to correct this, I suggest the following modification: (works like a charm for me)

 

Edit the following file: root/themes/your_theme/product-list.tpl

Find this line:

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

And replace it by this:

{if isset($product.on_sale) && $product.on_sale && $product.on_sale == 1 && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}

Basically it will force to look at the "On sale" state to enable the "On sale" ribbon.

 

 

 

NL.

 

Hi NOLOGIC , i ask u if u know the way to put a new imagen ribbon is some combination only.

Example:

 

I have reed blue an yelow and i like  whensome user chosse the yellow combination  show product  ( image) +  the ribbon (png file).

And this in all the entire site!

Sry my english isnt very good

Thanks!

Jon

Link to comment
Share on other sites

Hey Bolonia,

 

I feel like you need some special customization on the code side, or maybe a module does already that?

Or what if you put the ribbon on the product's image it self? I guess you have different product images for different combinations, so why not putting the ribbon directly on the picture that is associated to the desired combination?

 

I can't help you more, sorry :/

 

Good luck.

 

NL.

Edited by NOLOGIN (see edit history)
Link to comment
Share on other sites

  • 3 years later...

Hello,

 

We have done something like this but we needed to update only some products with specific category, so we have done this (at phpMyAdmin with PS 1.6.0.5):

 

UPDATE ps_product p
INNER JOIN ps_category_product cp ON cp.id_product = p.id_product
SET p.on_sale=1
WHERE cp.id_category = 8;

UPDATE ps_product_shop ps
INNER JOIN ps_category_product cp ON cp.id_product = ps.id_product
SET ps.on_sale=1
WHERE cp.id_category = 8;

 

Maybe somebody find it usefull 🙂

  • Like 2
Link to comment
Share on other sites

  • 1 year later...
On 6/19/2020 at 8:58 AM, CyberPepe said:

Hola,

 

Hicimos algo como esto, pero necesitábamos actualizar solo algunos productos con una categoría específica, así que lo hicimos (en phpMyAdmin con PS 1.6.0.5):

 

ACTUALIZAR ps_product p
INNER JOIN ps_category_product cp ON cp.id_product = p.id_product
SET p.on_sale = 1
DONDE cp.id_category = 8;

ACTUALIZAR ps_product_shop ps
INNER JOIN ps_category_product cp ON cp.id_product = ps.id_product
SET ps.on_sale = 1
DONDE cp.id_category = 8;

 

Tal vez alguien lo encuentre útil 🙂

I have tested it and it works perfectly in PS 1.7 but it only activates the label in the product card but not in the category listing. 

could you tell me if you can activate the label in the product listing?

thank you very much

 

 

Sin título-1.png

Sin título-2.png

Edited by cucada (see edit history)
Link to comment
Share on other sites

I have tried it and when selecting it manually it does appear in the list. 

 

Issue resolved 
the category was missing in the sentence 
now it is also displayed in the category list 

great contribution

thank you very much 

image.thumb.png.8aa60023d2b6306646c8f77f52c52801.png

 

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...