Post by Daz1847 » Fri Apr 01, 2011 11:02 pm

Using OpenCart V1.4.9.3

I have been looking all over for this and have found a post that seems to be the answer but I can only assume that it is possibly for an older version of OpenCart as I do not have the same code within my cart.tpl file and my template uses the cart.tpl file from the default theme.

[MOD] - Add "Please select..." to all options and validate.
http://forum.opencart.com/viewtopic.php?f=23&t=10866

I know about a module called Mega Global Options and it looks very good but I do not need all the fluff that it can do I only need to make the product options required/compulsory before the item can be added to the cart.

This is a simple thing to do within the options/admin area of most if not all other cart projects like ZenCart for example I really don’t understand why OpenCart does not have this little feature as standard.

Does anyone know how this can be done and what code needs to be changed or added in the default cart.tpl file or is it possibly in a different file with version 1.4.9.3 ?

Please help!...
Last edited by Daz1847 on Fri Apr 01, 2011 11:29 pm, edited 2 times in total.

Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer
- http://shortlink.info/?cda56b00


User avatar
Newbie

Posts

Joined
Fri Apr 01, 2011 10:33 pm

Post by Qphoria » Fri Apr 01, 2011 11:03 pm

By default, ALL options are required in OpenCart. They are select boxes.. you can't "not" select an entry in a select box.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daz1847 » Fri Apr 01, 2011 11:15 pm

Sorry I probably didnt explain propperly.

What I meen is for example just say I had these options.

Option1
Option2
Option3

when the ad to cart button is pressed it automatically selects option1 if the customer forgot to select an option.

This will be a problem if this should happen as i will post option1 but really they wanted option2 or option3.

What I need is a way to make it that if they do not select an option at all then it can not be added to the cart.

at the moment I have it set with a default option that is always out of stock called select an option this then shows in the cart as out of stock and will not allow checkout until an option is selected but this is a bit of a micky mouse way around it.

I need it to not be able to ad to cart at all if they forget to select an option.

Thanks..
Last edited by Daz1847 on Fri Apr 01, 2011 11:19 pm, edited 1 time in total.

Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer
- http://shortlink.info/?cda56b00


User avatar
Newbie

Posts

Joined
Fri Apr 01, 2011 10:33 pm

Post by i2Paq » Fri Apr 01, 2011 11:18 pm


Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________

Our FREE search: Find your answer FAST!.

[How to] BTW + Verzend + betaal setup.


User avatar
Global Moderator

Posts

Joined
Mon Nov 09, 2009 7:00 pm
Location - Winkel - The Netherlands

Post by Daz1847 » Fri Apr 01, 2011 11:22 pm

Yes that is the post that I already found and is exactly what I need.

[MOD] - Add "Please select..." to all options and validate.
http://forum.opencart.com/viewtopic.php?f=23&t=10866

But the code does not match anything like the code it says to find in my default cart.tpl file it simply is not there.

This is the code within my cart.tpl file ajax is enabled:

Code: Select all

<div id="module_cart" class="box">
  <div class="top"><img src="catalog/view/theme/default/image/basket.png" alt="" /><?php echo $heading_title; ?></div>
  <div class="middle">
    <?php if ($products) { ?>
    <table cellpadding="2" cellspacing="0" style="width: 100%;">
      <?php foreach ($products as $product) { ?>
      <tr>
        <td align="left" valign="top" style="width:1px"><span class="cart_remove" id="remove_<?php echo $product['key']; ?>">&nbsp;</span></td><td valign="top" align="right" style="width:1px"><?php echo $product['quantity']; ?>&nbsp;x&nbsp;</td>
        <td align="left" valign="top"><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a>
          <div>
            <?php foreach ($product['option'] as $option) { ?>
            - <small style="color: #999;"><?php echo $option['name']; ?> <?php echo $option['value']; ?></small><br />
            <?php } ?>
          </div></td>
      </tr>
      <?php } ?>
    </table>
    <br />
    <?php if ($display_price) { ?>
	<table cellpadding="0" cellspacing="0" align="right" style="display:inline-block;">
      <?php foreach ($totals as $total) { ?>
      <tr>
        <td align="right"><span class="cart_module_total"><b><?php echo $total['title']; ?></b></span></td>
        <td align="right"><span class="cart_module_total"><?php echo $total['text']; ?></span></td>
      </tr>
      <?php } ?>
    </table>
	<?php } ?>
    <div style="padding-top:5px;text-align:center;clear:both;"><a href="<?php echo $view; ?>"><?php echo $text_view; ?></a> | <a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
    <?php } else { ?>
    <div style="text-align: center;"><?php echo $text_empty; ?></div>
    <?php } ?>
  </div>
  <div class="bottom">&nbsp;</div>
</div>
<?php if ($ajax) { ?>
<script type="text/javascript" src="catalog/view/javascript/jquery/ajax_add.js"></script>
<?php } ?>

<script type="text/javascript"><!--

function getUrlParam(name) {
  var name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp(regexS);
  var results = regex.exec(window.location.href);
  if (results == null)
    return "";
  else
    return results[1];
}

$(document).ready(function () {
	$('.cart_remove').live('click', function () {
		if (!confirm('<?php echo $text_confirm; ?>')) {
			return false;
		}
		$(this).removeClass('cart_remove').addClass('cart_remove_loading');
		$.ajax({
			type: 'post',
			url: 'index.php?route=module/cart/callback',
			dataType: 'html',
			data: 'remove=' + this.id,
			success: function (html) {
				$('#module_cart .middle').html(html);
				if (getUrlParam('route').indexOf('checkout') != -1) {
					window.location.reload();
				}
			}
		});
	});
});
//--></script>
Thanks.

Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer
- http://shortlink.info/?cda56b00


User avatar
Newbie

Posts

Joined
Fri Apr 01, 2011 10:33 pm

Post by Qphoria » Sat Apr 02, 2011 2:19 am

I can update the mod.. but still.. if people are too stupid to open their eyes and choose the options then too bad for them :)

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by marc_cole » Sat Apr 02, 2011 2:36 am

Qphoria wrote: if people are too stupid to open their eyes and choose the options then too bad for them :)
Well put! ;)

Seriously, though, it's for this very reason that I asked for a solution to this situation. If we can make our stores idiot proof, we can come out looking better than the competition, and by association, so does OpenCart.

OpenCart v1.4.9.4
VQMod | Categories Home | Cleaner By Default - 2 Column | Speak Good English


Active Member

Posts

Joined
Tue Dec 14, 2010 11:26 am
Location - Seattle, WA

Post by Daz1847 » Sat Apr 02, 2011 2:38 am

Hey!...

I figured it out.

Thanks for the help pointed me in the right direction.

Just in case anyone else would like this I have attached everything thats needed at the bottom of this post
It's so easy just upload to your OpenCart directory and copy past a couple lines in

index.php

and

admin/index.php

and thats it your all done.

Simple instructions included

You can download it free here

Sorry

Attachment removed by Moderator
Last edited by Daz1847 on Sat Apr 02, 2011 3:04 am, edited 6 times in total.

Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer
- http://shortlink.info/?cda56b00


User avatar
Newbie

Posts

Joined
Fri Apr 01, 2011 10:33 pm

Post by Qphoria » Sat Apr 02, 2011 2:51 am

LOL I think you are missing something.. yes that is a script for vQmod..
Which means you simply need to install vQmod first..

Second, why reattach that file when it already exists here:
http://forum.opencart.com/viewtopic.php ... 66#p123337

It is best to post to the original so that it can be updated in one place. You also don't want to include the vQmod class file with the script because it would overwrite future updates.

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Daz1847 » Sat Apr 02, 2011 3:01 am

Ah well

Sorry Qphoria Global Moderator I was just trying to help.

I simplified the process and thought it was a good idea to make it easier for others to find that don’t know much about PHP and all that stuff and found that post very Misleading just for this simple implementation.

That’s all I done with my OpenCart and it worked great.

Well every one that needs this will just have to go here then and figure it out Sorry again.

Original Post
http://forum.opencart.com/viewtopic.php?f=23&t=10866

Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer
- http://shortlink.info/?cda56b00


User avatar
Newbie

Posts

Joined
Fri Apr 01, 2011 10:33 pm

Post by bitsmobile » Fri Jun 29, 2012 11:58 am

Hello,
I am using the following setup for options

Option: Pepperoni
Option Value:1 None
Option Value:2 Whole Pizza
Option Value:3 Left Side
Option Value:4 Right Side

Option: Sausage
Option Value:1 None
Option Value:2 Whole Pizza
Option Value:3 Left Side
Option Value:4 Right Side

the problem is the topping is shown in cart if it is not selected so lets say you chose no toppings you will see all 23 toppings in cart like this green peppers:none ... mushrooms:none etc how can i code the cart.tpl or cart.php to hide this?

New member

Posts

Joined
Sun Jun 24, 2012 5:32 pm
Who is online

Users browsing this forum: No registered users and 17 guests