Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
 All Forums
 Technical
 PHP (Unix / Linux / Apache) versions
 Client wants Will Pick Up Minimum Order Amount
Author « Topic »  

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 09/18/2020 :  18:32:36  
I have a client who asks this:

"Can you set up an order minimum that is tied to the "Will Pick Up" check box? If so, we would like to make a pick up order minimum of $30."

Is there a setting in the cart or can one be added to do this?

As always, thanks in advance for your help.

Ray Cramblit

Vince
Administrator

42464 Posts

Posted - 09/19/2020 :  00:57:00  

dbdave
ECT Moderator

USA
10276 Posts

Posted - 09/19/2020 :  07:27:41  
Hi Ray, I can see a way where this can be done with Javascript and basically in the cart page, it's possible to check the order total and then use css to hide the will pickup option unless the order is over a set amount.
If you need help with it, send me a message.

Thanks,
David

dbdave
ECT Moderator

USA
10276 Posts

Posted - 09/20/2020 :  10:09:01  
Hi Ray, posting this here in case anyone else wants to use it.

In your cart.php page just add the following in the "content" area of your page, but after the include line somewhere

<?php
include "vsadmin/inc/inccart.php"
?>

This is just a small bit of basic javascript and you can set this up several ways.
You will need to set your amount threshold too.

<!-- minimum will pick up amount begin -->
<script>
var minpikupamt = 100
var ordsubtot = (<?php echo $totalgoods ;?>);
if (ordsubtot < minpikupamt) {
if (document.getElementsByClassName('cdformtwillpickup')[0]){
document.getElementsByClassName('cdformtwillpickup')[0].style.display = "none";
document.getElementsByClassName('cdformwillpickup')[0].style.display = "none";
document.getElementsByName("willpickup")[0].disabled = true; ;}
}
</script>
<!-- minimum will pick up amount end -->


Be sure to change the number in red there to the amount you want customers to spend to get the pickup option.

This does two things - It disables the input from being ticked, and hides the the input and text as well.

If you want to show the box and text (maybe add a message so customers know why it can't be ticked) then just remove these two lines
document.getElementsByClassName('cdformtwillpickup')[0].style.display = "none";
document.getElementsByClassName('cdformwillpickup')[0].style.display = "none";
from the code.

This will not be overwritten by updates and this is for .php only.
One small change for .asp if anyone needs it.

You can see it working on the test site here - https://www.floridasurpluswarehouse.com/dev/products.php
Add 100+ in product to the cart for the will pick up option to show.

Thanks,
David

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 09/20/2020 :  11:02:24  
Thanks for the script. I really appreciate your help.

Ray Cramblit

dbdave
ECT Moderator

USA
10276 Posts

Posted - 09/20/2020 :  11:54:58  
Glad I could help Ray.
Let me know if you have questions or issues.

David

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 09/22/2020 :  12:09:16  
Dave,
In your instructions you say:

If you want to show the box and text (maybe add a message so customers know why it can't be ticked) then just remove these two lines
document.getElementsByClassName('cdformtwillpickup')[0].style.display = "none";
document.getElementsByClassName('cdformwillpickup')[0].style.display = "none";
from the code.

1) Where do I add the message so customers know it can't be ticked? Do I just add additional text to the text that is currently set as $willpickuptext or can that be set within your script code? If within your code, how is that coded?

2) I also want to hide the checkbox and text under "Payment Method": Pay Cash at Pick Up. What additional code do I need to hide those items?

Ray

Ray Cramblit

dbdave
ECT Moderator

USA
10276 Posts

Posted - 09/22/2020 :  18:26:55  
Hi Ray, for the text, yes you just set that with $willpickuptext
Something like Local Pickup (min $30.00) might do the trick.

As for hiding one of the payment options, I probably need to look at the site.
There are no unique css classes for payment radios so we need to target that another way.

Post a link, or send a message with one so I can see the site and I'll work on it.
I am guessing this is the "email" payment provider, no?

Thanks,
David

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 09/22/2020 :  18:46:27  
Does this help?

From Developer Tools:

Page Outer HTML
==============
<div class="checkoutadditionals copayradio1"><div class="cobhl cdformpayradio1"><input type="radio" name="payprovider" id="pprovid4" class="cdformradio cdformpayment" value="4"></div><div class="cobll cobll2 cdformpayment"><label class="cdformradio" for="pprovid4">Pay Cash at Pick Up</label></div></div>

CSS Selector
===========
div.checkoutadditionals:nth-child(15)

CSS Path
=========
html body div#mainmenucontainer.mainnav div#interiorpagecontainer div#middlediv form div.cart2details div#cartlistid2.cartlistcontents.cartmaincontents div.checkoutadditionals.copayradio1

Ray Cramblit

dbdave
ECT Moderator

USA
10276 Posts

Posted - 09/22/2020 :  19:09:41  
Hi Ray, I added the code and some comments

I tested this on my php test site and it works.
The code assumes that the email payment provider is the first one showing.

<!-- minimum will pick up amount begin -->
<script>
var minpikupamt = 100 //change number to your desired amount
var ordsubtot = (<?php echo $totalgoods ;?>);
if (ordsubtot < minpikupamt) {
if (document.getElementsByClassName('cdformtwillpickup')[0]){
document.getElementsByClassName('cdformtwillpickup')[0].style.display = "none";
document.getElementsByClassName('cdformwillpickup')[0].style.display = "none";
document.getElementsByName("willpickup")[0].disabled = true; ;}
if (document.getElementById("pprovid4")){ //remove email payment provider begin
document.getElementById("pprovid4").style.display = "none";
document.getElementsByClassName('cdformpayment')[1].style.display = "none";} //remove email payment provider end
}
</script>
<!-- minimum will pick up amount end -->

RayCramblit
Advanced Member

USA
173 Posts

Pre-sales questions only
(More Details...)

Posted - 09/22/2020 :  19:58:01  
Thanks again!

Ray Cramblit
  « Topic »  
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000