Post by sully210 » Sat Dec 03, 2016 4:01 am

When I order products on my site with options that are NOT REQUIRED the item goes directly into the cart and the product page with the options does not even appear. If I have options that ARE required, both the required options and non required options appear. Here is my URL:
http://tequilasauthenticmexican.210worl ... ry&path=59
The test product here has both required and non required options while all 3 of the other products here have non required options. Please help as I need to deliver this site tonight.

Also, FYI, I am not receiving notifications when people reply to my posts even though I check the box to receive them.

Thank you.

Thank you,
Sully :)


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 4:46 am
Location - USA

Post by phenomena » Sat Dec 03, 2016 8:39 pm

sully210 wrote:When I order products on my site with options that are NOT REQUIRED the item goes directly into the cart and the product page with the options does not even appear. If I have options that ARE required, both the required options and non required options appear.
as i understand you already fixed your issue? or explained the problem incorrectly... I have checked and did not find anything strange in your options mechanism's behaviour...
If all OK, close the topic

Opencarting
Image


User avatar
New member

Posts

Joined
Tue Jul 03, 2012 2:18 am
Location - Ukraine

Post by sully210 » Sat Dec 03, 2016 9:19 pm

It works when I click the product title, but not when I click "ORDER" in

Code: Select all

<button type="button" onclick="cart.add('121', '1');"><i class="fa fa-shopping-cart"></i> <span class="order-add">Order</span></button>
I have tested it in all browsers and get the same result. I will check the code for that file and see if there is something wrong.

Thank you,
Sully :)


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 4:46 am
Location - USA

Post by sully210 » Sat Dec 03, 2016 10:06 pm

I have checked the code and it is still not working. Though I did indeed modify the product/category.tpl file the code for that particular button group matches the code from the original file. I even uploaded the original 2.0.3.1 file and that did not work either. I have cleared all cache and done a hard refresh of the page every time as well. For some reason, clicking the word "ORDER" sends the products directly to the cart, no matter what. Any help on fixing this is greatly appreciated.

Thank you,
Sully :)


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 4:46 am
Location - USA

Post by artcore » Sun Dec 04, 2016 12:23 am

Hi Sully,
If I understand correctly you want the customer to be redirected to the product page if there are options, required or not. You can do this by changing the controller/checkout/cart::add method.
Something like: if product_options and route is not product/product add a new json error so it redirects to the product page.

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by sully210 » Sun Dec 04, 2016 1:48 am

artcore wrote:Hi Sully,
If I understand correctly you want the customer to be redirected to the product page if there are options, required or not. You can do this by changing the controller/checkout/cart::add method.
Something like: if product_options and route is not product/product add a new json error so it redirects to the product page.
Thanks. That sounds complicated for someone like me but I will try it when I get a few minutes.

Thank you,
Sully :)


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 4:46 am
Location - USA

Post by artcore » Sun Dec 04, 2016 5:57 am

It is a bit more complicated as the route is the url in ajax. Below should work. Don't forget to refresh the modification cache!

controller/checkout/cart/add

Code: Select all

//redirect to product page if there are options, required or not
			if(!empty($product_options)){
				$route = isset($this->request->get['product_page'])
				? $this->request->get['product_page']
				: 0;
				
				if($route == '0'){
					$json['error'] = 'check our options first';//not used anyway	
				}
			}
			//redirect to product page if there are options, required or not//
Screenshot_2016-12-03-22-51-18.jpg
product.tpl

Code: Select all

$('#button-cart').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add&product_page=1',//add &product_page=1 to the url
.....

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by sully210 » Sun Dec 04, 2016 10:45 am

Code: Select all

$('#button-cart').on('click', function() {
   $.ajax({
      url: 'index.php?route=checkout/cart/add&product_page=1',//add &product_page=1 to the url
.....
product.tpl? catalog\view\theme\default\template\product? On line 1? Above

Code: Select all

<?php echo $header; ?>
I am sorry. I am not really stupid but I am still learning all of this. I am doing much better with my HTML, CSS and I am really working on getting better with the PHP.

Thank you,
Sully :)


User avatar
Active Member

Posts

Joined
Tue Jul 13, 2010 4:46 am
Location - USA

Post by artcore » Sun Dec 04, 2016 3:31 pm

That one is javascript ;D
I commented on what I changed and added some lines extra so you can pinpoint it easier.

catalog/view/theme/default/template/product/product.tpl

Code: Select all

url: 'index.php?route=checkout/cart/add',
becomes

Code: Select all

url: 'index.php?route=checkout/cart/add&product_page=1',
The screenshot should help find the spot for the other change in ... cart.php

And don't forget to clear modification cache!

Tested on my demo: http://demo.ilithemes.com/oc2302/laptop-notebook
That HP LP3065 has an option that's not required

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands
Who is online

Users browsing this forum: No registered users and 240 guests