Jump to content

Recommended Posts

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


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites

'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


Get the latest Responsive osCommerce CE (community edition) here .

Share this post


Link to post
Share on other sites
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.😏

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

@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.

Share this post


Link to post
Share on other sites

just to bug........ i play it again 4th time now


- ICECAT specialist.
(Icecat: open feed with product information, data-sheets for oscommerce.)
- CSV IMPORT specialist.
(manage your suppliers via supplier manager)
Contact me via PM.

Share this post


Link to post
Share on other sites

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...

 


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Hi @ArtcoInc,

See this post on the subject of hiding buy buttons:

 

Peter


PROUDLY PASSIONATE PHOENIX SUPPORTER

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

Join the Phoenix Club. Become a Phoenix Supporter.  Gain access to special codes and modules and help the project thrive. Read here

 

Share this post


Link to post
Share on other sites
9 hours ago, JcMagpie said:

I use this addon and it works correctly. Zero core modifications. Highly recommended.


Running Old EDGE, setting up a new Frozen site with many nice addons available on the market and waiting to be admitted to Phoenix club!

Community Oscommerce fan :heart:

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×