New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On product deletion, the display should work as expected #10

Merged
merged 2 commits into from Nov 30, 2018

Conversation

Projects
None yet
6 participants
@mickaelandrieu
Copy link
Contributor

mickaelandrieu commented Nov 19, 2018

Hi,

I've noticed that the list of viewed products is retrieved from customer/user cookie ... one of the main issues with that is when we delete a product in back office the users of the website are not "aware" of it ie the cookies are not updated.

It's a hack to fix a wrong implementation of a wrong problem (the data shouldn't be stored in a cookie and used "as it" to do a SQL query o_O) but now the data retrieved from the user is checked against the list of existing products in the shop database.

{
$existingProductsQuery = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT p.id_product
FROM ' . _DB_PREFIX_ . 'product p'

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Nov 19, 2018

Member

Should we filter by "enabled" products?

@@ -290,4 +295,16 @@ protected function getViewedProducts()
return false;
}
private function getExistingProductsIds()

This comment has been minimized.

@PierreRambaud

PierreRambaud Nov 19, 2018

Contributor

Doc block? :trollface:

This comment has been minimized.

@mickaelandrieu

mickaelandrieu Nov 20, 2018

Contributor

not sure, as no other functions have PHPDoc block xD

This comment has been minimized.

@PierreRambaud

PierreRambaud Nov 20, 2018

Contributor

Be a boy scout!

This comment has been minimized.

@mickaelandrieu

mickaelandrieu Nov 20, 2018

Contributor

this will make the pull request unreadable!

This comment has been minimized.

@PierreRambaud

PierreRambaud Nov 21, 2018

Contributor

You can do it bro!

This comment has been minimized.

@matks

matks Nov 26, 2018

Maybe the PHPDoc can be added in an 2nd PR ? So we have PR 1 that modifies code behavior, no refactoring ; and PR 2 that only adds harmless doc

@marionf

This comment has been minimized.

Copy link

marionf commented Nov 29, 2018

@mickaelandrieu The deleted produit still appear in the list of viewed products with no price & no image.

If the product has been removed, can we remove it from the list of viewed products ?

capture d ecran_687

@mickaelandrieu

This comment has been minimized.

Copy link
Contributor

mickaelandrieu commented Nov 30, 2018

I can't reproduce, you may need to clear your cookies as the information was previously stored in it.

Let me know if it works for you 👍

@marionf

This comment has been minimized.

Copy link

marionf commented Nov 30, 2018

I can't change the label but it's all good for me @mickaelandrieu 👍

@PierreRambaud PierreRambaud merged commit 7d55223 into PrestaShop:dev Nov 30, 2018

@PierreRambaud

This comment has been minimized.

Copy link
Contributor

PierreRambaud commented Nov 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment