Smile-SA / magento2-module-retailer

14 stars 29 forks source link

add-to-cart button #2

Closed AymericJoubert closed 7 years ago

AymericJoubert commented 7 years ago

When the full page cache is enabled, the add-to-cart button never appears.

In Smile\RetailerOffer\Plugin\ProductPlugin class the two methods getRetailerId and getPickupDate always return null.

The checkout session in RetailerData where are stored the infos seems to be empty when FPC is activated.

Flushing the cache does not change anything. The problem always appears if FPC is activated.

romainruaud commented 7 years ago

Hello @AymericJoubert, that's what I was saying in #1 .

You have to retrieve the retailer_id and the pickup_date on PHP Side from the Headers (X-Retailer-Id and X-Pickup-Date) because you do not have any cookie (Varnish is removing them).

You have to write a plugin for this class : https://github.com/Smile-SA/magento2-module-retailer/blob/master/CustomerData/RetailerData.php

You should override getRetailerId and getPickupDate to retrieve the values from the request headers in case there are no cookies on the current request.

AymericJoubert commented 7 years ago

getRetailerId and getPickupDate override worked.

Thanks, Aymeric