Post by msquaredstl » Thu Jul 12, 2018 7:48 am

My client has an apparel store that offers screen printing on a variety of items (T-shirts, hoodies, bags, etc.). They have a couple of different minimum quantities that they want.

First off, the overall order must be at least 12 items of any assortment. Most of the apparel has size breakdowns (XS through 4XL). Each of the apparel styles can be screen printed with one of seven designs. They want each design to have a minimum of 6 when ordering – this can be spread out over any screen printable item.

For example, a customer could purchase 6 shirts with design A, and 6 hoodies with design B to make up the minimum quantity of 12. They could also purchase a bag, men’s hoodie, women’s hoodie, men’s t-shirt, women’s t-shirt, and a tank top with design A and a similar quantity of design B to make the minimum of 12.

If a customer tries to order less than six of any design there should be an error asking them to add more products of the design.

I’m guessing the changes will need to be made in the checkout controller (\catalog\controller\checkout\checkout.php).

Can anyone suggest a good way to go about this?

Some ideas/questions that I had:
Unique identifier for each design, then count the total number, as long as it’s over 6 proceed to checkout.
Can a new field be added to the option values?
Can the Option Value SKU be used as a lookup across products?
Required ‘add-on’ product for the screen printing with minimum quantities.

As a disclaimer, I don't have much experience with Opencart 1.5, but I have used 2 and 3. So hopefully I should be able to figure out how to do this with some assistance.

Newbie

Posts

Joined
Thu Jul 12, 2018 6:46 am

Post by IP_CAM » Fri Jul 13, 2018 3:16 am

My client has ...
sounds, like you will be willing, to accept a commercial Solution on such. 8)
But a huge Amount of Extensions exists on such, it's just a little complicated,
to find out, what possibly fit's best.
Search under Options - Related Options - Dependent - Conditional - Minimum
to find most of them:
---
Search for Options
https://www.opencart.com/index.php?rout ... load_id=33
---
Minimum:
https://www.opencart.com/index.php?rout ... load_id=33
---
Good Luck! ;)
Ernie

For Sale: Top URL's, including an OpenCart V-Pro Installation, similar to:
http://www.bigmax.ch - http://www.ipcam.li - http://www.jti.li
For Information + URL's offered, please contact me at: jti@jacob.ch
I am NOT available for Custom Support in existing OC Installations!
My Github Repositories: https://github.com/IP-CAM
Image


User avatar
Guru Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by msquaredstl » Mon Jul 16, 2018 4:11 am

We have a minimum quantity extension installed, but the issue that we're having is that we want to have a minimum quantity on product options for multiple products as well as the product categories. The minimum quantity appears to work with the individual products, but doesn't work the way we want for the product options.

Newbie

Posts

Joined
Thu Jul 12, 2018 6:46 am

Post by msquaredstl » Sun Jul 22, 2018 6:24 am

Ok I came up with this validation in catalog/controller/checkout/cart.php around line 196

It works somewhat, though the store also has a minimum quantity of 12, so I don't know if that's interfering with the design code.
If anyone could recommend how I might make this work, I would greatly appreciate it.

Code: Select all

$products = $this->cart->getProducts();

foreach ($products as $product) {
$product_total = 0;
$product_design_a = 0;
$product_design_b = 0;
$product_design_c = 0;
$product_design_d = 0;
$product_design_e = 0;
$product_design_f = 0;
$product_design_g = 0;

foreach ($products as $product_2) {
	if ($product_2['product_id'] == $product['product_id']) {
		$product_total += $product_2['quantity'];
	}
	if (($product_2['category_id'] = 77) or ($product_2['category_id'] = 84)) {
		if ($product_2['option_value_id'] = 1238) {
			$product_design_a += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1239) {
			$product_design_b += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1240) {
			$product_design_c += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1241) {
			$product_design_d += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1242) {
			$product_design_e += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1245) {
			$product_design_f += $product_2['quantity'];
		}
		if ($product_2['option_value_id'] = 1246) {
			$product_design_g += $product_2['quantity'];
		}
	}
}

if ($product_design_a + $product_design_b + $product_design_b + $product_design_b + $product_design_b + $product_design_b + $product_design_b != 0) {
	if ($product_design_a != 0 and $product_design_a < 6) {
		$this->data['error_warning'] = 'Please add more products with Will Flex For Food w CE Logo Back design';
	}
	elseif ($product_design_b != 0 and $product_design_b < 6) {
		$this->data['error_warning'] = 'Please add more products with Like a Snack w CE Logo Back design';
	}
	elseif ($product_design_c != 0 and $product_design_c < 6) {
		$this->data['error_warning'] = 'Please add more products with Hangry w CE Logo Back design';
	}
	elseif ($product_design_d != 0 and $product_design_d < 6) {
		$this->data['error_warning'] = 'Please add more products with Eat Clean Train Dirty w CE Logo Back design';
	}
	elseif ($product_design_e != 0 and $product_design_e < 6) {
		$this->data['error_warning'] = 'Please add more products with Feed Me w CE Logo Back design';
	}
	elseif ($product_design_f != 0 and $product_design_f < 6) {
		$this->data['error_warning'] = 'Please add more products with Clean Eatz Logo Front Only design';
	}
	elseif ($product_design_g != 0 and $product_design_g < 6) {
		$this->data['error_warning'] = 'Please add more products with Cafe Front Only design';
	}

	if ($product['minimum'] > $product_total) {
		$this->data['error_warning'] = sprintf($this->language->get('error_minimum'), $product['name'], $product['minimum']);
	}
}

Newbie

Posts

Joined
Thu Jul 12, 2018 6:46 am
Who is online

Users browsing this forum: No registered users and 47 guests