I have been searching the forum looking for some help adding a 2nd Add to Cart button.
I have copied the code including the Quantity and pasted the code before the original one.
What happens is the following:
The new codes Quantity amount doesn't take effect, but whatever is typed in the original box is recorded.
The new codes Add to Cart button, changes to loading then adds the item to the cart but the old Add to Cart button does nothing.
Any ideas would be great.
Cheers!
What code?I have copied the code
Dedication and passion goes to those who are able to push and merge a project.
Regards,
Straightlight
Programmer / Opencart Tester
Of course, you can't just copy the code and don't change anything. What you have is absolutely valid result.
Professional OpenCart extensions, support and custom work.
Contact me via email or Skype by support@thekrotek.com
Sorry that was a bit lazy of me.
I copied the code in the template file
/theme/default/template/product/product.tpl
I have tried the whole div product section, then I've tried the quantity and button only code.
Mainly this code
Code: Select all
<div class="form-group">
<label class="control-label" for="input-quantity"><b><?php echo $entry_qty; ?></b></label>
<input type="text" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="form-control" style="width: 25%;" />
<input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
<br />
<ul style="list-style-type: none;margin: 0;padding: 0;">
<li style="display: grid;"><button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button></li>
Last edited by straightlight on Wed Jun 17, 2020 5:27 am, edited 1 time in total.
Reason: Added code tags.
Reason: Added code tags.
I agree completely thekrotek, I now understand that I can duplicate simple href buttons to my hearts content all over the place as many times as I want,
along with php echo any number of time
...... But I was looking for a pointer for the duplicate Add to Cart button like.... Do I need to setup a new Add to Cart2 id and script to match or is there something else I need to look at.
Thanks.
Found my answer in an old opencart version 1 general support post
viewtopic.php?t=118405
Gave the second button a unique id, like "button-cart2" and change the jquery to $('#button-cart,#button-cart2').bind('click', function() {
Can't believe how straight forward that was!
viewtopic.php?t=118405
Gave the second button a unique id, like "button-cart2" and change the jquery to $('#button-cart,#button-cart2').bind('click', function() {
Can't believe how straight forward that was!
Who is online
Users browsing this forum: No registered users and 104 guests