Xcart classic - Products randomly appearing disappearing from the cart - x-cart

I am using xcart classic 4.7.1 for my shop. We did a lot of customization in the code to make it suitable for my clients need. We made it live the previous year and everything worked fine. Now, these days a strange issue is happening. The products are randomly appearing and disappearing in the cart. Sometimes after adding the products to cart, the cart stays empty. It is not happening regularly. Sometimes if a product is deleted from the cart, previous products are randomly added into the cart again. Suppose the cart containing 4 products. Customer deleting the products one by one. After he deleted the last product, previously deleted products are showing in the cart again. As it is not happening regularly, it is very hard to track it and fix it. A lot of customers are complaining and my client is not happy now.
Thank you very much in advance. Blessings.

1)Try to convert the engine type from MyISAM to InnoDB for the xcart_sessions_data table.
For this
run the query
ALTER TABLE xcart_sessions_data ENGINE=INNODB;
2)Maybe upgrade to the newest X-Cart version will fix the problem.

Since there has been a lot of customization in your cart, as you wrote, the most probable reason is some bug in the customizations, related to the cart functionality. Have you had any customizations on the cart functionality itself?

Related

Older Power-BI pbix using a SharePoint-Online list that has had new fields added

I have a Power-BI dashboard that was created some time ago. It’s data source is a SharePoint-Online list. Since the Power-BI dashboard was created, several new fields have been added to the SharePoint list. Now I am being asked to add a new page to the dashboard that reports on those new fields. However, I have not found a way to get the existing Power-BI list/dataset to show the new fields.
Refreshing the data does refresh the values, but refresh does not add the new fields.
I’ve spend the last 4 hours looking on the internet for a solution. The only thing I have been able to do so far is to attach the list again with a different name- the new fields DO show up when I do this. (I can’t just replace the older Power-BI list/dataset because there have been several calculated columns and measures added.)
I can work with this and create the report, but is this the only way? It doesn’t seem like it should be.
Any help would be appreciated! Thank you!
(I'm using Power BI April 2021 and Sharepoint Online)
So, it looks like there's no good answer to this issue. I found that adding another instance of the reference Sharepoint list, that included the new columns, did work (however inelegant). That seems to be the best direct answer for times when the older pbix file must continue to be used.
What I ended up doing, though, was to create a new separate pbix file which included the latest version of the Sharepoint List. This was the best solution for my organization since it will allow us to be more focused on the specific manufacturing processes involved.
Thanks to #Jon and #Alejandro for their efforts to help!
If you have access to PowerAutomate you could refresh the dataset creating a flow so that given a certain time (say, once or twice a day) the dataset gets refreshed with the new created items.
Otherwise if you are working with the service version of Power BI you can program a refresh of the dataset directly from the workspace going to the settings of the dataset. You would have to have a gateway set for that which could be in personal mode or not.
Also if you want to update the data in the service version you could do it manually too in the workspace.

Django Oscar automatically empties the basket on redeeming an expired voucher

When a customer applies a voucher to an item in the cart and the voucher expires during the checkout process or inside the cart itself. During the checkout process, when clicked on place order, the cart automatically empties and the customer is sent this error, You need to add some items to your basket to checkout, this happens during the check_basket_is_not_empty method.
Can someone help me understand which part of Django-Oscar could be modifying the cart in such drastic way. My initial thought was, that the cart was getting emptied because some oscar component was trying to remove the voucher and was removing the cart item as well. But during some more checks I find out that the voucher is successfully removed but the cart item only gets removed inside the PaymentDetailsView, probably.
I don't have the code to PaymentDetailsView. I started the job as a Django developer a couple of days ago and I was thrown into this huge django-oscar code base, which I am completely unfamiliar with. I am not allowed to post any code online. I don't know what to do, and don't want to get fired. Any help would be highly appreciated.
I still don't know what's causing this bug, but I came up with this solution. When you click "place order", the PaymentDetailsView class gets triggered, and the first function to deal with all the data is the submit one. So inside that, you can manually check the vouchers you have in the request and remove the vouchers manually.
# removing expired vouchers:
for voucher in self.request.basket.vouchers.all():
if voucher.is_expired() or not voucher.is_available_to_user(user=self.request.basket.owner)[0]:
self.request.basket.vouchers.remove(voucher)
messages.error(self.request,_("The '%(code)s' voucher has expired") % {'code': voucher.code})

How to know where database has changed

I have a project that looks like a simple shopping site that sells different kinds of products. For example, I have 4 models: Brand, Product, Consignment. Consignment is linked to Product, and Product is linked to Brand. To reduce count of queries to databases, I want to save current state of these models(or at least some of them). I want to do it, because I show a sidebar with brands and products. So every time when user opens some page, it will execute the query to database to get those brands and products.
But when admin add some new product or brand, I want to handle database changing and resave it. How to implement it?
Your answer is by using Cache. Cache is a method to store your objects in memory/other app like redis temporarily so that you do not need send queries to database. You can read the full description here.
Or, you can use this third party library that helps you to cache Django ORM Model. Here are the example.
Brand.objects.filter(name='stackoverlow').cache()
After doing an update to the model, you need to clear or invalidate the cache.
invalidate_model(Brand)

What strategies can I use in Sitecore to archive items and then restore later via code?

We are building a Sitecore site that will pull in some product data from an external database. On a nightly basis we will query the external database and either Add, Update or Archive/Delete/Remove product content items in Sitecore as needed. Our data template has some fields that will be populated directly from the external database (and will be read-only for content authors) and other fields that they will populate themselves. Included in our custom fields will be the SKU of the item from the external database. It is possible that over time a product could disappear from the external database. In this case we would want Sitecore to somehow remove this item from our list of products, but not completely delete it. The reason for this is that the products that have been removed could reappear in the future and we would not want to lose all of the data that had been added to other custom fields on the item. I can think of a number of different approaches for this:
Use Archiving/Recycling features of Sitecore. When we find that there is a product item in Sitecore that no longer appears in the external database, then we could archive it. That works well. However I can't seem to figure out a way to restore that item later if it reappears in the external database. I don't have any access to any custom fields when an item is archived (from what I have read online). So when I come across a SKU in the external database that is not in Sitecore, I have no way of figuring out if there is an archived item that has that SKU.
Use a custom status field on each product content item. I could set each product content item to "active" or "inactive". This would make it easy to reactivate items that reappear in the external database. However I worry about things like search and publishing. It seems messy to me to have some content items that are inactive in the folder of all products in the master database. It could be confusing to content authors and I worry that they will find their way in to the web database, etc. It seems like I would have to do a lot of custom coding to make sure that those products do not show up on any pages, etc.
When a product disppears from the external database I could then move those content items to a different location in Sitecore. Then when they reappear I could move them back. This also feels messy.
I just wonder if there is some better solution that I am missing. Thanks in advance for any help.
I would go with option 2 "Setting status field on each product "Active" or "Inactive", as its more clear and keep the data in one place.
Additional thing to do (as suggested by Vasiliy) is to set the "Publishable" checkbox on product to "False", this way the product will disappear from web database, hence no extra filter in your search methods.
You can implement custom content editor warning to inform content editor that the current product is "inactive":
Creating Custom Content Editor warnings
Hope this helps
Just a thought what if you just unpublished the items that were removed from the external database and set the ones in the authoring db unpublishable until they reappear again. With this scenario, you could also have a task running archiving items that have been unpublished and not republished for a given period of time.
The best solution really depends on the number and frequency of items appearing / disappearing and the cost benefit of keeping those items in the authoring database vs. deleting them.

Magento products not visible via REST api addition

I'm currently running into the problem that I am using a webservice system to load products into magento.
I'm using the REST api in conjunction with Oauth to create products and assign a category. It works and when I go to the admin I can see the products as well as see they are properly assigned to the correct category. When I open the category management in the management console i can see i have (example: 106) items assigned in the category.
However, the problem is: It does not show in the site.. even with refreshing anything that is cache or index.
When I open up the management console and open 1 article and save it without changing any other property and then Save it. I can suddenly see the item in the front end webshop...
I'm lost to why this occurs.. also for 19k product updates it is becoming a bit of an annoying bit of work to update this amount of products since any bulk update method does not do the same as editing just 1 product at a time.
Any help is much appreciated.
In the end I have discovered the answer myself. Thought it might be nice to list it here as well.
In the 'rights' tab i added all the accessrights for the user using the api. This allowed me to read products etc. Very stupid mistake but somehow I overlooked this at first.
IF you'd expect security errors.. you wont get any. just empty lists and null responses.