PS PrestaShop Beginner

DataFirefly Cart History & Restore Links: cart history and restore links

Installation, restore links in the back office, My saved carts page, settings, link security and troubleshooting.

Updated Module version 1.0.0

Installation

Install the module from Modules > Module Manager > Upload a module by sending the ZIP file, or copy the dfcartrestore folder into the /modules/ directory of your shop and click Install.

Installation creates a log table (dfcartrestore_log), generates the secret key that signs links and adds the My saved carts page to the customer account. No native table is altered: restored carts are ordinary PrestaShop carts.

How it works

A restore link never transfers a cart. When someone opens it, the module reads the lines of the source cart and adds them one by one to that person’s own basket, as if they clicked Add to cart for each item.

  • The source cart is never modified, whether it belongs to another customer or is tied to an order.
  • Nobody is logged into the account of the cart owner, unlike the native PrestaShop cart recovery link.
  • Prices, promotions, stock, minimum quantities and availability for order are those at the time of the restore.
  • The same link can be used several times, by several people.

Cart list

In Customers > Shopping Carts, the Restore link column shows a Copy link button for every cart that contains products. The link is copied to the clipboard without opening the cart. In the CSV export of the list, this column contains the plain URL.

Cart detail page

At the top of the cart page, a panel shows the full link with Copy link and Open buttons, and how many times the link has been used. If a validity period is configured, the expiry date is shown.

Customer page

The Carts and restore links block lists the customer’s last 10 non-empty carts, with their date, number of items, products total, ordered status and the copy button.

The link is generated in the language and for the store of the cart: an Italian customer gets a link to the Italian version of the shop.

With the preview page enabled (default setting), the link opens a page listing the cart items with thumbnails and quantities. The visitor clicks Add these items to my basket to run the restore, then is redirected to the cart or to checkout depending on your setting.

A message sums up the result: number of products added, vouchers applied, quantities adjusted to stock and items that could not be added.

For a quote prepared over the phone, build the cart from Orders > Add new order, then copy its link from the cart list and send it to the customer.

My saved carts page

The My saved carts link appears in the customer account and in the My account block of the footer. The page lists the customer’s carts that contain products, newest first, each with:

  • the date of last update, the number of items and the products total;
  • the Ordered status with the reference and a link to the order, or Not ordered;
  • product thumbnails and an expandable detail where items that are no longer available are flagged;
  • the Restore this cart button and, if enabled, the Copy share link button.

The customer’s current cart is not listed. In replace mode, a confirmation tells the customer that the current cart will be replaced and that it will be available again on this same page.

Settings

Customer account

  • Show the cart history in the customer account: enables the My saved carts page and its links.
  • Restore behaviour: Replace the current cart creates a new cart and keeps the previous one in the history; Add to the current cart merges the items with those already in the basket. Guests always merge, as they could not get a replaced cart back.
  • Show carts already converted into an order: lets customers reorder the same items in one click.
  • Carts per page: from 1 to 50, 10 by default.
  • History period (days): only carts updated during this period are listed, 365 by default, 0 for no limit.
  • Allow customers to copy a share link: useful in B2B, when a buyer prepares the cart and a colleague places the order.
  • After restoring, send the customer to: cart page or checkout. If items were adjusted or skipped, the customer always goes through the cart page to see them.
  • Link validity (days): applies to links generated from now on, 0 for links that never expire.
  • Show a preview page before restoring: recommended, see the Security section.
  • Carry over vouchers: Never, Only when the customer restores from the account (default) or Always. A voucher is only applied if it is still valid for the new cart and its owner. Automatic rules without a code are reapplied by PrestaShop itself.

Each link carries the cart ID and an HMAC-SHA256 signature computed with the module’s secret key. An ID edited by hand makes the link invalid.

The Invalidate all existing links button regenerates the secret key: every link shared until then stops working, and the new links shown in the back office work normally.

Mail gateways (Outlook Safe Links, Proofpoint, Mimecast) and link previews in Slack, Teams or WhatsApp open links automatically. If you disable the preview page, every automatic visit from a regular browser would create a cart. Recognised bots always get the preview page, even when it is disabled.

Rules applied during a restore

  • Product disabled, not available for order or not in the store: skipped.
  • Deleted combination: skipped.
  • Quantity below the minimum quantity: raised to the minimum quantity.
  • Not enough stock and out-of-stock orders not allowed: quantity reduced to the available stock if it still meets the minimum, otherwise the item is skipped.
  • Customized product: texts copied, uploaded files duplicated on the server, so deleting the copied line never removes the file of an order.
  • No item added: the cart created for the restore is deleted and the visitor’s current cart is restored.

Restoration log

The configuration page shows the last 30 restorations of the store: date, origin (link or customer account), source cart, new cart, customer or guest, number of items added and skipped. Cart numbers open their page in the back office.

For developers

  • actionDfcartrestoreAfterRestore: fired after each successful restore, with id_cart_source, id_cart and origin (link or account).
  • actionDfcartrestoreCustomizationCopy: fired after a customization is copied, with id_customization_source, id_customization, id_cart_source and id_cart. A module that stores its own data per customization (configurator, engraving) uses it to duplicate that data.

Troubleshooting

The column or panel does not appear for some employees

PrestaShop skips a module’s hooks when the profile of the logged-in employee lacks the View permission on that module (Advanced Parameters > Team > Permissions, Modules section). Grant this permission to the relevant profiles.

The link was truncated by the email client, or all links were invalidated after it was sent. Copy a new link from the back office.

The validity period is over. Copy a new link, or increase the validity period for future links.

Check that the customer account option is enabled, then clear the shop cache. Some themes do not display the displayCustomerAccount hook; the page is still available at index.php?fc=module&module=dfcartrestore&controller=carts.

Compatibility

  • PrestaShop 8.0 to 9.x, the same ZIP covers both branches.
  • Multistore, multilingual and multicurrency.
  • No Composer dependency.
  • Interface available in French, English, Spanish, German, Italian, Dutch, Polish and Portuguese.
Was this page helpful?

Still stuck? Contact support