Category products don't match database - sql

I have a script that deletes specific entries from [prefix]_category_product ( => removes products from a category) using SQL.
Though the changes are successfully made in the database and in the Prestashop admin interface, they don't show on the front-end. Some products which have been removed from a category still appear in it.
I don't think it's a caching issue because emptying the Prestashop cache and the browser cache doesn't work, and they don't disappear after a few days/weeks. If I add and remove the product from the category manually using the admin interface it works. What am I doing wrong?

You are forgetting the ps_product and ps_product_shop tables,
where the id_category_default value is stored.

Related

Product names are N/A and remain the same after renaming in Prestashop [1.7.8.2]

I am a junior (barely) dev and recently inherited a Prestashop project (version 1.7.8.2).
In both admin panel and main page all the products have N/A instead of actual name.
Even if I rename them they remain N/A.
ALTHOUGH In Database all the names are displayed correctly.
The site is in French only so in ps_lang table there is only one lang mentioned (Thus it's not possible to add translation to it).
I tried exporting products in CVS then deleted them from admin panel and then importing them again, didn't work.
Did anyone come across this issue? What are possible reasons of this bug?
IDs in tables ps_product and ps_product lang don't match.
Probable solution - try rewrite IDs in ps_product table manually, might take time, might not work, but at least I can see clearly the problem here.

What records in my PrestaShop database do I need to remove to clean up the data

We have an eCommerce Prestashop (ver 1.7.2) shop. Our initial testing is okay and our shop is ready for deployment. We need to remove the order records to have a clean version of the shop. What table records do we need to remove?
Search in your Modules Catalog for cleaner, the full name is PrestaShop Cleaner.
Install it and give it a go.
Official statement:
PrestaShop Cleaner can only be managed from the back office. It allows you to roughly clean your store by deleting your whole catalog, orders, and customers.
For example, this module allows you to suppress all demo data in one go. But this module must be used carefully: once you delete it all, there is no possible rollback. Everything is removed for good.

Prestashop - Refresh cache after database changes

I had to make some changes on the ps_product table of a Prestashop 1.6 store (id_tax_rules_group for example). However, these changes are not being reflected in the store itself. What should I do?
You need to make changes in ps_product_shoptable as well.
Here is a similar problem.

E-Commerce Principles - Show Inventory Dynamically or with static pages?

I am curious regarding this. Is it a better practice to have static html pages displaying the current inventory? This would obviously entail having to manually update these pages when items go in/out of stock, adding new items, etc.
Or is it a more common practice to use dynamic pages to load your store's inventory directly from a database?
If your products never change, and you only have a few products, than you can probably get by without using a database. But if you need to update new products every so often, or if you want to add features like filtering, search, sorting, etc., than having a database is the way to go. It also has the added benefit of organizing your product line in a rational way. If you have more than a dozen products though, you'll want to use a database so that you can code one view that populates according to the product selected. Otherwise, if you want to change the layout, you'll have to do with each product.

Wordpress manually Attach Images to Post using SQL

I have created a custom post type called products and need to associate multiple images with one product. The actual data already exists in a different non-wordpress database in a table called productimages that simply has a productid, imageurl, and image title. I need to convert this data into wordpress format so wordpress can display everything I need. This is something that will be done regularly using sql automatically deleting products and meta data related and re-adding from our main database which changes regularly.
From what I can tell, the best way to make this work is to manually use sql to insert the productimages as attachment posts just like wordpress does when you upload media to wordpress. Then to associate the image with a product I have to manually insert records into postmeta but the data in postmeta is serialized or something and I am unsure how I would insert the data in the correct serialize format using mysql. Is it even possible to do this with mysql?
Am I going about this wrong? Should I be doing something different? I was originally going to use custom fields till I realized a custom field can only have one value and I needed two values: imageurl and imagetitle for each image. So it seems programatically creating a post type of attachment for each image is the best way to go. yes?
I look forward to anyone's response to help in this matter.
Not an expert on serialization for wordpress but have you checked the wordpress php function maybe_serialize