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!...
Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer - http://shortlink.info/?cda56b00
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..
Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer - http://shortlink.info/?cda56b00
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.
[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']; ?>"> </span></td><td valign="top" align="right" style="width:1px"><?php echo $product['quantity']; ?> x </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"> </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>
Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer - http://shortlink.info/?cda56b00
Well put!Qphoria wrote: if people are too stupid to open their eyes and choose the options then too bad for them

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
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
Unlimited Everything Hosting + Anytime Money Back Guarantee
Only£1.95pm - Limited Time Offer - http://shortlink.info/?cda56b00
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.
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
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?
Users browsing this forum: No registered users and 12 guests