Post by spitos » Mon May 23, 2011 6:35 pm

Hi all,

I'm new to OpenCart and just testing it out to see if it has some features our company require. Hopefully someone can help? I have OpenCart v1.4.9.5 installed.

We need the ability to list an individual product multiple times in different categories, with unique tiles, descriptions and accessories for each of these. However, we need to have all of these variants use the same SKU or whatever field is used for inventory purposes so no matter which variant is ordered, it comes off the same stock code and removes one item out of stock.

We sell laptop accessories. We have 1 physical product in our warehouse which can fit up to 500 laptops. We need to list each laptop individually but use a single stock code for the item that fits into it, no matter how many laptops it fits into.

Example:
SKU: PRODUCT1
Fits Models: ACER LAPTOP, HP LAPTOP 1, HP LAPTOP 2, COMPAQ LAPTOP

SKU: PRODUCT2
Fite Models: HP LAPTOP 3, HP LAPTOP 4, COMPAQ LAPTOP 2, DELL LAPTOP

If we don't do this, we end up with 100's of stock codes for the same physical product.

We alsready have this fetaure on our existing ecommerce package but need to move away from it and OpenCart looks good. Can OpenCart offer us this feature? Does anyone know how?
Last edited by spitos on Tue Aug 30, 2011 3:40 pm, edited 1 time in total.

User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by spitos » Mon Jul 25, 2011 11:37 pm

Any ideas on this anyone?

Is it actually possible?

Thanks

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Mon Jul 25, 2011 11:55 pm

Would suggest adding a random suffix to the end so that it stays unique but you still know which stock it refers to:

12345-a
12345-b
12345-c

They are all 12345

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Tue Jul 26, 2011 12:20 am

Hi Simon,

I'm not sure if I explained this properly, don't think what you suggested will work as it would still create a separate stock item, this is the issue really. Basically need to figure out how or what field opencart uses to deduct an item from stock or if it can be modified.
If we have 500 products with the same SKU, we'd like the stock to be deducted across that SKU so all products with that SKU have one less item in stock.
At the moment, PRODUCT1 AND PRODUCT2 DO have the same SKU, but if someone orders PRODUCT1 on the site, only stock from PRODUCT1 is deducted, PRODUCT2 stock levels stay the same.

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Tue Jul 26, 2011 12:34 am

Ah, I understand now

Well, without modifying, this is the best way of doing it:

Create one product (one sku)

Link it to multiple categories

Creates attributes for the product listing all the possible branded products it will work with

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Wed Aug 03, 2011 4:44 pm

Thanks for the advice Simon, a couple of people have suggested this too but I think it just takes away from the site overall for a number of reasons. Do you think the method i'm trying to use would actually be possible with opencart?

Do you do any custom work?

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Wed Aug 03, 2011 5:27 pm

It's certainly possible but would require some heavy coding.

Each product would need multiple titles and multiple descriptions and coding would be required to differentiate which title/description combination to use dependant on which category.

You may do better posting your request in the Commercial Support forum.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Wed Aug 03, 2011 10:24 pm

I'm not very clued up on this (can you tell ? :) ) but in theory, would it be possible to write some sort of function that simply tells the database to -1 stock for all products that match the SKU that has been ordered (rather than product_id) at the point of sale when it already goes through that routine?

Does that sound logical?

That way, it can keeps everything in opencart as it is but still solve our stock issue.

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Wed Aug 03, 2011 11:12 pm

open: catalog/model/checkout/order.php

before:

Code: Select all

	public function confirm($order_id, $order_status_id, $comment = '') {
add:

Code: Select all

	public function getskufromprodid($order_product_id) {
		$query = $this->db->query("SELECT sku FROM `" . DB_PREFIX . "product` WHERE product_id = '". (int)$order_product_id ."'");
		
		if ($query->num_rows) {
			return $query->row['sku'];
		}else{
			return 0;
		}
	}
	
find:

Code: Select all

			foreach ($order_product_query->rows as $order_product) {
				$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_id = '" . (int)$order_product['product_id'] . "' AND subtract = '1'");
				
				$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product['order_product_id'] . "'");
			
				foreach ($order_option_query->rows as $option) {
					$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND subtract = '1'");
				}
			}
replace with:

Code: Select all

			foreach ($order_product_query->rows as $order_product) {
				$sku = $this->getskufromprodid($order_product['product_id']);
				
				$this->db->query("UPDATE " . DB_PREFIX . "product SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE sku = '" . $sku . "' AND subtract = '1'");
				
				$order_option_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_option WHERE order_id = '" . (int)$order_id . "' AND order_product_id = '" . (int)$order_product['order_product_id'] . "'");
			
				foreach ($order_option_query->rows as $option) {
					$this->db->query("UPDATE " . DB_PREFIX . "product_option_value SET quantity = (quantity - " . (int)$order_product['quantity'] . ") WHERE product_option_value_id = '" . (int)$option['product_option_value_id'] . "' AND subtract = '1'");
				}
			}
** Caveat - Not Tested
** Caveat - will only update product options for the ordered product if you use options because there is no easy way of finding the same option for a different product.

Try it and let me know how you get on

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Wed Aug 03, 2011 11:51 pm

Thanks Simon, much appreciated.

I'll give it a try and let you know how I get on. Which file is the code in?

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by spitos » Wed Aug 03, 2011 11:57 pm

Simon, i'm sorry but i haven't updated my version since my original post back in May, using v1.5.1.1 now.

I think this code may have changed?

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Thu Aug 04, 2011 1:30 am

Updated my code above for 1.5.1.1

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Thu Aug 04, 2011 5:59 pm

Simon, you are a genius!! It works! :good:

Many, many thanks for helping me out with this, it's the main thing which has been holding us back with opencart.

I'll be putting an order in for your SEO URLs & admin email alerts very soon.

RE the options... I didn't think opencart removed options from stock anyway, or am I wrong?

Thanks again!

Mike

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Thu Aug 04, 2011 6:05 pm

Re the options.

Stock control is also done on the options if you have them set to subtract stock, however, there is no way of referencing them (well not easily) as they dont (even though they really should) have their own model number or sku.

So with the code I put above, only the stock on the options (if you have any set-up) for the product purchased will be reduced.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by spitos » Thu Aug 04, 2011 6:11 pm

Ok that clears things up about the options.

Thanks a lot, I have been speaking to a company who have claimed to fix the problems with options so if I find a fix I will post it here.

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by uksitebuilder » Thu Aug 04, 2011 6:19 pm

It certainly can be done, but a lot more code is needed, so if you only want the products main stock to be correct, then my code above will suffice.

Basically for the options stock, a db lookup for the related product id's needs to be done and then a look-up for their options with the same option value, then the quantity can be deducted from those aswell.

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by doughnut features » Tue Dec 06, 2011 2:09 am

@ Spitos. Did this solution work for you eventually? We have the same problem. One SKU fitting multiple products.

If so is opencart a good solution?


Posts

Joined
Tue Dec 06, 2011 1:39 am

Post by spitos » Mon Dec 12, 2011 6:01 pm

Yes, Simon's code meant that stock is deducted based on the SKU and not the product id so it works fine.

I'd definitely recommend opencart as a good solution. You may have to apply some tweaks here and there, especially if you have lots of products or categories but overall it has been very easy to work with and it is easily customisable.

What are you currently using?

Image
Google Analytics Expert - Advanced e-commerce tracking, Product & options reporting, transaction/conversion reporting, Google Adwords conversion & profit reporting, goal & funnel reporting, event tracking, site search tracking, multi-store compatibility, EU Cookie Law compliance and works with any theme or checkout! Easy vqmod install. Get it here


User avatar
Active Member

Posts

Joined
Mon May 23, 2011 6:19 pm
Location - UK

Post by ebayer » Wed Feb 06, 2013 12:53 am

@ Spitos and doughnut features just wondering if both of you are still using this and if you are what version of OC you are using? I'm looking exactly the same thing except it's belts I sell that can fit different manufacturer's equipment so I stick to one product per manufacturer otherwise it becomes too confusing for customers. I have no product options so that takes a little of the complexity out of it though I do sell on eBay however I'll see if I can get this working first before I look at integrating eBay through something like openbay pro.

Newbie

Posts

Joined
Sat Jan 19, 2013 3:14 am

Post by scanreg » Wed Feb 06, 2013 1:16 am

try OpenStock extension maybe

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am
Who is online

Users browsing this forum: No registered users and 15 guests