products with lots of attributes combinations in woocommerce - wordpress

I have a site using woocommerce, I have imported products from an old oscommerce site, some of the products have several attributes, woocommerce threats those attributes as combinations, the problem is that each product come imported with thousands of combinations and my site crashes.
One example (Not real site):
I have one product with two attributes, color y size,
Colour has Red(+$50), Black(+$150), White ($+30)
Sizes has M(+$25), L(+15),XL(+58)
And you'll have multiple variations, in this case, 9 I think.
Now you have 10 different attributes, each with 20 or 30 possible values.
You'll have thousands of variations, this is what makes the site crash. I need to find a way to code or modify the system queries so this variation are less heavy and have fewer iterations, since if as soon as I try to load the product on the site, my database just dies.
Thank you.

Related

Scraping E-Commerce sites and aggregating same products

I am trying to learn about web-scraping and as an application I figured I'd build an aggregator that crawls retailers for certain products and sets up a price comparison for the same product from different retailers.
As I got started on this I realized exactly how large a tasks this is.
First, I need to crawl sites that have various formats for not only their DOM structures but also slightly different names for the same products and formats for item's prices and prices for items on sale.
Second, After I've somehow decoded the DOM for x number of sites (doing it for one or two is easy but I want to make the crawler scalable!) and fetched the data for various items. I need to be able to compare the different names of same products so I can compare the differing prices (convert them to the same currency, check if the returned price is the original/on-sale price, etc...) between retailers.
I am trying to write my crawlers using Scrapy but can someone recommend an approach for how to adapt the crawler for a variety of retailers and if there are any libraries/approaches that would work well for the second problem of comparing like(unlike) items?
For comparison you can convert strings of product names to lists, compare them and put a threshold to determine whether two products are same or not.

Woocommerce reduce inventory programmatically when related variation is purchased

Ok, will do my best to explain the problem.
I am selling limited edition prints on my site. They come in multiple sizes, and they also come framed and unframed.
Right now, I set up each product to have 2 attributes: size & frame.
Within the variations, I have 4 options
11x17 unframed
11x17 framed
20x30 unframed
20x30 framed
The problem occurs with the inventory. There are 10 total 11x17 prints, but since I have to enter a stock quantity for each variation, I have to do something like this:
11x17 unframed 10qty
11x17 framed 10qty
Which makes it seems as though there are 20 total prints, instead of 10.
Ideally, I'd want to keep inventory based on attribute, not variation, but there doesn't seem to be a way to do that.
I am unable to set up the Frame as an add-on product because the cost of the frame goes up, as the size of the print goes up.
I am wondering, if there is a way to programmatically reduce the stock of other variations, when one variation is purchased. So, when someone purchases the "11x17 unframed", the "11x17 framed" stock is reduced -1 at the same time.
All of the products on the site are exactly the same, so I wouldn't mind hard-coding the specific variation names in the code.
Not sure if something like this is doable, but I would hugely appreciate any insights.
This is the closest example I could find to customizing how stock is handled:
Reduce WooCommerce Item Inventory By Attribute Value
Thanks in advance,
Jenny

Woocommerce reuse values in variable products

I hope someone can help me with this :)
I will be selling a product that has 10 variables, but all the choices need to be the same for all, how can I add and reuse the values once instead of copying and pasting values 10 times?
What I will be selling is a 10 meal bulk package and each meal needs the
same choice values.
Picture of what I'm trying to achieve here
Thanks for any help in advance :) Scott
I have 3 different products, 5 meals, 7 meals and 10 meals in which the customer can choose their own meals, the attribute values will also be changing weekly. which at the moment I am pasting in new values 22 times in the edit product.
If I delete and duplicate the product I lose the URL
When I go to Products > attributes still the same making 10 attributes like meal 1, meal 2, meal 3 etc I can't duplicate them and have to do it all manually up to 40 times with new values.
[Picture Front end here]
(https://dl.dropboxusercontent.com/u/61411490/Screen%20Shot%202015-09-17%20at%2009.33.32.png).
This is a very late answer, but I have encountered the same issue and my solution might be of interest to the next person who happens on this question.
I am using WP All Import and the Woocommerce extension (both free, but variable products require a license) to maintain product details in excel. Updating data on the website is as easy as uploading a new CSV. Keeping data in sync in an excel file, with references, formulas, etc. becomes much easier, and you can often completely factor out duplicate data.
Instead of using Woocommerce's variable products, I created each version as a simple product and linked between them.

woocommerce - large number of variations for a variable product

I have a variable product with 3 attributes. The total number of variations generated is 900. This will make the admin page incredibly slow and hard to work with, so I need to find a workaround. I thought about replacing the dynamically generated dropdowns(for attribute values) with static ones, but the shopping cart expects to receive a variation number, which is non-existent in this case. I'd also like to mention that the variations are identical in all parameters, besides the attributes. How can I solve this?
Thanks.

WordPress query multiple post_types/categories with weighted results

For a WordPress project I'm looking for a better solution to this problem:
The query should get a set of different post_types and taxonomies (like categories), based on the site visitors choice. For example, the user want to get results from normal posts, but also products (from WooCommerce) and other post_types like events and news (both separate post_types. The tricky part is, that the user wants to assign a weight factor to each. So if they select like posts = 1, products = 3, news = 4, they should get a number of posts, three times more products and 4 times more news.
Next step will be to include categories, also with the weight factor, which will make it even more complex, because for posts, I need to query another taxonomy than for products.
The only way I found to solve this, is to run a separate query for each post_type, like fetching 10 items from posts, 30 items from products and 40 from news, to match the weight factors, then combine the results. But this will not scale very well when I need pagination (for example, I want to show 50 entries on the first page, next 50 on second page).
I thought about collecting these single queries into a temporary table, but such a table will be available for the current session only, so it won't help with the pagination (as the temporary table would no longer exist, when the second page is shown).
Does anybody have an idea, how I could approach this task? I would like it according to the WordPress coding standards, so I would like to use WP_Query and the provided filters, because the site is also using geolocating and WPML for translation, so I really would like to avoid writing a low-level query where I have to include all these manually.
I'm not looking for a final solution, just want to collect some ideas.

Resources