How to get a product modification log in Prestashop? - prestashop

Is there a way to know what specific changes were made to a product in Prestashop 1.7?
In Advanced parameters> Logs I can see the employee who has made the modification, the severity, the message of the modification, the id of the object that has been modified and the date on which the modification was made, but it does not show me what the modification was. specific change that was made, if the name, price, description etc.
Is there a way to know that?

There is a way but it's a complex issue, you can hook into dynamic hooks like:
actionObjecProductUpdateBefore
and
actionObjectProductUpdateAfter
and compare two set of object data to see what has been changed.
Of course if you want to log more detailed informations like changes in Specific Prices etc. you also need to get informations about them before and after product change, it might be a time and resource consuming operation so be careful with it.

Related

The "size" variation attribute is preselected in Storefront (SFRA) causing bad orders as customers forget to adjust to the right size

This storefront sells clothes among other things and the size is a key selection that we want the customers to make explicitly.
Because SFRA pre-selects the size customers overlook the choice and will inadvertently checkout the wrong size, as this is the preselected choice made by SFRA.
This causes increased load on our customer service and returns handling and a bad customer experience (it is hard to argue whether the customer selected the wrong size or the storefront had preselected the wrong one and they were not aware).
How can I change this behavior so that the size is not preselected?
Current behavior: Size is preselected:
Desired behavior: Customer must select the size themselves:
SFRA version: 5.3.0
The functionality you desire is included in the variationAttribute template in SFRA v5.3.0. You can also confirm the functionality on the SFRA demo site - see this product on the demo site for a comparable example.
I've inferred that you still have the "Select <attr>" option in the dropdown, which is added by the variationAttribute template, and the Add to Cart button in your second screenshot is appropriately disabled (unless you manually adjusted these for your screenshot). This suggests you likely you have some custom clientside script that is performing the automatic selection of the first variation. This automation reduces clicks in cases where the first is likely what the customer wants, so some UX guidelines recommend the experience you have, at the expense of the problems your support team are now dealing with. Perhaps as a compromise, this functionality should only trigger if there is only one available selection for a given attribute.
Without a link to an example, it's difficult to diagnose where this code might be. I would start by searching my custom clientside scripts for a selector matching the variationAttribute's select element. I might also use devtools to inspect the change listeners on each of the attributes, which should trigger slicing and availability checks. These checks disable unavailable options in other attributes, and would be the appropriate place for the automatic selection customization to occur.

Extend Spartacus NGRX Store with additional data

For our Spartacus project, we need to introduce additional Data properties in the checkout:
We have the case, that the user needs to select a delivery mode per product.
In an ideal world, upon selection, the selected delivery mode would be saved in the NGRX Store and also in the Backend to stay within the principle of the data binding defined here: https://sap.github.io/spartacus-docs/connecting-to-other-systems/#component-data-binding
Expected Data / User flow:
User goes to Checkout and to Delivery Mode Step
Custom OCC Call is made to load the supported delivery modes for each product (depends on product type and further customer specific logic)
The cart items are displayed, enhanced with a dropdown containing the available delivery modes
The user selects a delivery mode
The selected delivery mode is stored on the cart entry within the NGRX Store and saved in the backend
The new Cart totals is calculated based on the costs of the selected delivery mode
The new Cart totals is stored on the cart within the NGRX Store and saved in the backend
The user clicks on continue to get to the Review Order Step
The cart items are listed with the previously selected delivery mode
After some analysis of the existing code, we found a property deliveryMode on the orderEntry. This does not seem to be used anywhere in spartacus, but could be used to make Step 9 work by following this stackoverflow answer and this one.
Questions regarding this flow:
How can we extend the NGRX Store? We assume, it would be possible to just extend the facade (Active Cart Service), bypass the store and save the information in the backend (Described here) and afterwards refresh the store from the backend. Is that Assumption correct? If yes, that feels awkward though, as we need to reload the whole store just to contain the new property deliveryMode on the orderEntry
How can we hook into the price calculation of the cart totals to update the total based on the selected delivery mode? And again, how can we bring the new total sum into the store?
There seem to be several Answers within the Slack Channel without very few usable answers around extending the ngrx store, even though for us, it seems to be a quit normal task.. :-/
Any thoughts, inputs or support would be very appreciated. :-)
This seems like a difficult thing to accomplish seeing as delivery modes per product aren't supported as-is in spartacus. But some ideas:
You can extend core CartEntry classes (adapter, connecter, facade, etc.) to include the delivery mode for entries added to the cart. You will probably need to change all to include the delivery mode setting(s). All of these are exposed so you can modify them as needed including the store.
Utilizing multiple carts to have a product per cart and set delivery mode that way. But this would be cumbersome in my opinion.
As far as price calculation goes, I'm assuming OCC calls return total prices. Does the call for the cart entries include delivery mode costs per entry?
We have implemented the following work around and it works so far:
Enhance the Cart Model in the backend
Add new Endpoints to load the available delivery Modes per Product (by bypassing the NGRX Store)
Add new Endpoints to save the selected Delivery Mode (by bypassing the NGRX Store)
After Save Endpoint, a cart Reload is triggered, which loads the new cart totals having a custom property on the order entry (via type augmentation) into the store from the backend
It's already a lot of years past since Spartacus project started, but looks like it's still really raw projects. Spartacus is not ready to deal with real word customer's requirement and complexity of customize it quickly grow at real project(so you start to think do we really need it, as it's so unflexible at some dimentions). Some parts is really hard or not possible to customize, so you begin to search a workarounds(This question is one common case).
I think NGRX Store is one of the biggest pain in the ass to customize something at Spartacus. 2 years past and nothing changed by Spartacus team...

How to set Custom Fields Notifications in HP Project and Portfolio Management(PPM)?

I am using HP Project and Portfolio Management(PPM) tool and I am adding a custom field in my request type which has date as value. Now my requirement is to send the email notifications to the users once the date mentioned in the custom field crosses the system date.
I had tried to set the notification for field level from Notification tab but not getting the custom fields in the list. All the fields, which is available, are pre-configured fields.
So, can anyone suggest me how to implement this requirement? And also where the changes need to be done If any required to implement this?
Please answer in detail and also reply soon.
Thanks in advance!!
PPM notifications can be configured on pre-defined events, like a certain transition, or timeout etc...
One possible solution for this scenario is to have timeouts on your decision step. Time out goes to an execution step, which checks for the date condition. If the condition is met it fires the notification. Else it just returns to the original decision step.
The downside of this work around is that there will be transaction details added once daily. Also the last update date of the request keeps updating daily, which is not ideal if you want to track what was the last time an end user update the request.
It is a workaround cause of the restrictions around notification events.
And if you have a large workflow, I would not recommend this work around.

QuickBooks API - Retrieve only data that has changed

I am building an app that accesses the QuickBooks API v2.
I am looking for a way to retrieve only data that has changed.
For example, from time to time want to be able to check to see if there have been any changes to the chart of accounts in the QB data. Is there a quick way to do this without parsing a large response body? Maybe something like requesting and comparing just a checksum, and then requesting the whole chart of accounts to compare and update if there is a change? Or even just requesting the changes that occurred after a certain date?
This need is not just limited to the chart of accounts. For example, I may want to update historic transaction data, but only with the changes (e.g., a change to an old transaction), not the entire db which can be quite large.
Answer
In further reading the API docs, I should be able to filter the response using the created_at and updated_at metadata.
The filter is called Change Data Capture (CDC)
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0100_calling_data_services/0015_retrieving_objects
<ItemReceiptQuery xmlns='http://www.intuit.com/sb/cdm/v2'>
<CDCAsOf>2010-12-04T09:30:47.0Z</CDCAsOf>
</ItemReceiptQuery>
thanks
Jarred

"Dynamic" Pricing System

Soon I'll be working on a project that amounts to what is essentially an e-commerce app for configured products. This question is about ways to implement pricing schemes that can change from day to day, so we want to get the pricing logic out of code and into a database, but not in a way that causes the database to do all the work.
The basic idea is this, there are 5 attributes. You pick an option from each of those attributes. Then you start adding products to your cart. All the product you add will have those 5 attributes tacked onto them (the attributes will affect the pricing). Once you've added a product, you can apply modifications to it (the attributes will also be applied to the modifications).
So, what we've got at this point is a product (which has a fixed base price) with some information about it (that will modify the price), and zero or more modifications (which has a fixed price) and some information about them (which will modify the price). Modifications can also incur additional charges. For instance, if company A uses this software and they price their items using: BASE_PRICE + $50 * NUM_WHIRLIGIGS and the item has a modification that adds a WHIRLIGIG, that will have to be reflected in the price.
Do you know of any examples of different pricing systems that I might find useful when determining how to set this up? Do you have better ideas?
My current best thought is below, you can skip it if you're not curious about the particulars of the method and just want to get right to the answering!
For any given item (or collection of items) the company could use a special interface to set up pricing formulas which would then be interpreted and evaluated at run-time.
So for PRODUCT_A, the company might put in something like BASE_PRICE + WHIRLIGIG_UPCHARGE * NUM_WHIRLIGIGS. And the software, when it comes time to price it, would look at how many WHIRLIGIGS the item has, as well as how many WHIRLIGIGS are added by any modifications.
Does anyone have experience implementing this kind of interpreter? How did it turn out? Was it difficult/troublesome?
Thanks in advance for all the awesome input I'll sure I'll get. :P
Typically, this is usually handled with product bundles which have components. So a product with 5 additional subcomponents would not be base + 5 * addon, but SUM(base, addon, addon, addon, addon, addon).
So your product table may either be self-referential or there is some kind of link table which says which sub-products are allowed to be attached to which products.
In my experience, pricing is usually stored on a product/customer or contract basis, so that's another table.
Then the actual orders themselves contain product bundles. If the order is a quote, then the pricing is frozen (up to the expiration of the quote).
When an quote or order is turned into an invoice, at that time the pricing is either locked in from the main pricing or the quote, depending upon the pricing timing paradigm.