ArtcoInc Posted September 11, 2019 Share Posted September 11, 2019 There are several things I like to conditionally hide ... for example, if an item is out of stock, I want to hide the 'Buy' button. If a customer puts an item in their shopping cart, and then increases the quantity to more than is available, I want to hide the 'Checkout' button. Historically, I just hacked the code (yes, I hack the core code <hanging head in shame>) with an IF statement. Is there a better way? I know that @burt has done something like this in one of his 28 days bundles, but he used JavaScript, and I know *nothing* about JavaScript. I also have no idea how hooks work ( @burt , any chance someone could write up a tutorial on how hooks work, and how to use them? Or, a link to a resource that explains them?). I'm just a 'copy and paste' kind of guy. TIA Malcolm Link to comment Share on other sites More sharing options...
ArtcoInc Posted September 11, 2019 Author Share Posted September 11, 2019 'Allow Checkout' is set to false. The 'Checkout' button still shows, and if you click on it, it takes you to the 'checkout_shipping' page. Clicking on the 'Continue' button takes you back to the shopping cart. My point is, if there's not enough stock, don't even have a 'Checkout' button. Or a 'Buy' button. Oh, and I also installed an add-on that displays the available stock quantity in the shopping cart, so the customer doesn't have to guess how many are available (yes, another core code hack <sigh>). But, this doesn't answer my initial question ... What's the best way to hide these buttons? Hooks, hacks, or JavaScript? M Link to comment Share on other sites More sharing options...
kgtee Posted September 11, 2019 Share Posted September 11, 2019 1 minute ago, ArtcoInc said: 'Allow Checkout' is set to false. The 'Checkout' button still shows, and if you click on it, it takes you to the 'checkout_shipping' page. Clicking on the 'Continue' button takes you back to the shopping cart. My point is, if there's not enough stock, don't even have a 'Checkout' button. Or a 'Buy' button. Ah, I hacked the code to force a redirect back to cart with a gentle reminder.😏 Link to comment Share on other sites More sharing options...
ArtcoInc Posted September 11, 2019 Author Share Posted September 11, 2019 One vote for Hack 😀 Link to comment Share on other sites More sharing options...
kgtee Posted September 11, 2019 Share Posted September 11, 2019 I too have items that say you must buy between x and y quantities. I have to insert MOQ and max in the quantity input fields. I don't see anyway I can do without hacking. I am sure @burt is not restricting anybody from hacking. He ever mentioned that this is the beauty of openness of OSC codes. Link to comment Share on other sites More sharing options...
kgtee Posted September 11, 2019 Share Posted September 11, 2019 @fridgebox You have a good point. I actually make the customer stay at the cart until the quantities are correct. The continue to checkout shipping is a default behaviour of OSC, I did not change it. Link to comment Share on other sites More sharing options...
fridgebox Posted September 11, 2019 Share Posted September 11, 2019 just to bug........ i play it again 4th time now Link to comment Share on other sites More sharing options...
♥JcMagpie Posted September 11, 2019 Share Posted September 11, 2019 JcM No Stock Buy Button V1.1 Link to comment Share on other sites More sharing options...
burt Posted September 11, 2019 Share Posted September 11, 2019 The answer is pretty simple; you do whatever it takes to get it working as you want... hook ht module content module js / jquery hack code The less intrusive way...is...in my opinion...the better way. For the buy buttons, the simplest way is a piece of .js as a Hook. 1 file, done - set and forget. There is a hook bit that I posted just yesterday, scan back through my last few posts... Link to comment Share on other sites More sharing options...
♥peterpil19 Posted September 11, 2019 Share Posted September 11, 2019 Hi @ArtcoInc, See this post on the subject of hiding buy buttons: Peter CE PHOENIX SUPPORTER Support the Project, go PRO and get access to certified add ons Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design. Download the latest version of CE Phoenix from gitHub here Link to comment Share on other sites More sharing options...
valquiria23 Posted September 11, 2019 Share Posted September 11, 2019 9 hours ago, JcMagpie said: JcM No Stock Buy Button V1.1 I use this addon and it works correctly. Zero core modifications. Highly recommended. Community Oscommerce fan You'll find the latest osC community version here. Link to comment Share on other sites More sharing options...
♥JcMagpie Posted September 11, 2019 Share Posted September 11, 2019 based on idea by BrockleyJohn @BrockleyJohn Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.