Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add to Cart Button for Out of Stock

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 09-22-2016, 09:29 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Add to Cart Button for Out of Stock

How did you add this code?

Also, I believe the default controller class reloads the page after processing the method, so this may be the reason why you don't see the message.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
RexxBattery (09-23-2016)
  #12  
Old 09-23-2016, 05:42 AM
 
RexxBattery RexxBattery is offline
 

Member
  
Join Date: Aug 2016
Posts: 13
 

Default Re: Add to Cart Button for Out of Stock

Quote:
Originally Posted by qualiteam
How did you add this code?

Also, I believe the default controller class reloads the page after processing the method, so this may be the reason why you don't see the message.

Thank you, that definitely confirms my suspicions. I was just randomly throwing it in different functions that are called when the button is pressed. As of right now, I have it so that it just pops up when the page is loaded (which also makes it pop up when clicked the button is clicked due to the reload). Can you think of any way to get it to pop up before the page is reloaded when the button is clicked?
__________________
5.2.16
Cloud Search
Market Price
Volume Discounts
Reply With Quote
  #13  
Old 09-26-2016, 09:09 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Add to Cart Button for Out of Stock

You can render the widget upfront and hide it with CSS, and then change the CSS class when users click the button.

Another way is to load the widget via an asynchronous request to the server. If this is what you are looking for, you should look through the existing source code and search for examples of use of ALoadable object. Usually, this is how you use it:
1. You create a new "view" object that is extended from ALoadable object, then you extend the prototype of that object with custom methods and properties. This object will handle the rendering of the widget and loading its contents from the server.
2. You create another object extended from AController and make it autoloaded by the core. This object will check for particular element on the page (specific for your widget) and, when exists, create and start your "view" object.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:26 AM.

   

 
X-Cart forums © 2001-2020