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

Default Product Values

 
Closed Thread
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 10-19-2015, 11:38 AM
  razortw's Avatar 
razortw razortw is offline
 

X-Cart team
  
Join Date: Feb 2015
Posts: 807
 

Default Re: Default Product Values

Quote:
Originally Posted by BrianY
Igor,

If he upgrades XC5 will these changes remain?
No, this will be overwritten during the upgrade.
As you said earlier, any change to X-Cart logic must be implemented as a module in order to avoid it getting rolled back after upgrade.
__________________
Best regards,
Igor Pudovkin
X-Cart hosting team

The following 2 users thank razortw for this useful post:
BrianY (10-19-2015), superdave144 (10-21-2015)
  #12  
Old 10-19-2015, 01:29 PM
 
superdave144 superdave144 is offline
 

Advanced Member
  
Join Date: Sep 2015
Posts: 77
 

Default Re: Default Product Values

That worked! Thank you!
__________________
David
X-Cart Business 5.3.2.2
  #13  
Old 10-21-2015, 07:09 AM
  razortw's Avatar 
razortw razortw is offline
 

X-Cart team
  
Join Date: Feb 2015
Posts: 807
 

Default Re: Default Product Values

Quote:
Originally Posted by superdave144
That worked! Thank you!
Great! I'm glad that I could help.
__________________
Best regards,
Igor Pudovkin
X-Cart hosting team

The following user thanks razortw for this useful post:
superdave144 (10-21-2015)
  #14  
Old 11-30-2016, 12:16 PM
 
superdave144 superdave144 is offline
 

Advanced Member
  
Join Date: Sep 2015
Posts: 77
 

Default Re: Default Product Values

This fix doesn't seem to be working anymore. Is there a new place to put this value?
__________________
David
X-Cart Business 5.3.2.2
  #15  
Old 12-05-2016, 12:43 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Default Product Values

As far as I see the constant is still there (in the most recent 5.3.2.x version).

However, I think a better way of changing the default stock level is decorating the \XLite\Model\Product::getDefaultAmount() method, not AMOUNT_DEFAULT_INV_TRACK constant itself.

Something like this:
PHP Code:
// File: classes/XLite/Module/DEV_ID/MODULE_ID/Model/Product.php

namespace XLite\Module\DEV_ID\MODULE_ID\Model;

class 
Product extends \XLite\Model\Product implements \XLite\Base\IDecorator
{
    
/**
     * Default qty value to show to customers
     *
     * @return integer
     */
    
public function getDefaultAmount()
    {
        return 
1;
    }

__________________
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
  #16  
Old 12-05-2016, 05:45 AM
 
superdave144 superdave144 is offline
 

Advanced Member
  
Join Date: Sep 2015
Posts: 77
 

Default Re: Default Product Values

Ok which file do I need to append this to? Am I adding code to a file or modifying existing code?
__________________
David
X-Cart Business 5.3.2.2
  #17  
Old 12-05-2016, 10:21 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Default Product Values

You should never edit existing files. Custom modification must be done as isolated modules with new files - this will help you to adapt the changes for future X-Cart versions.

The above is for a new PHP script - classes/XLite/Module/DEV_ID/MODULE_ID/Model/Product.php (you should replace DEV_ID and MODULE_ID with your ones). Of course, you should also add Main.php script as per the documentation.
__________________
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
  #18  
Old 12-05-2016, 12:30 PM
 
superdave144 superdave144 is offline
 

Advanced Member
  
Join Date: Sep 2015
Posts: 77
 

Default Re: Default Product Values

I'm sorry I've never done this before. Can you please provide a procedure?
__________________
David
X-Cart Business 5.3.2.2
  #19  
Old 12-05-2016, 11:01 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

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

Default Re: Default Product Values

Please follow this tutorial:
http://devs.x-cart.com/en/getting_started/step_1_-_creating_simplest_module.html

You are to create a new module and add the file that I posted the source code for above.
__________________
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
  #20  
Old 12-06-2016, 10:44 AM
 
superdave144 superdave144 is offline
 

Advanced Member
  
Join Date: Sep 2015
Posts: 77
 

Default Re: Default Product Values

Ok I added the new module and enabled it. The Main.php is configured in /classes/XLite/Module/JRG/Quantity directory. I created the new product.php file in the /classes/XLite/Module/JRG/Quantity/Model/ directory. I redeployed the store after the module was created as well. The default quantity is still showing 1000. Do I need a reference from the Main.php to the product.php file?
__________________
David
X-Cart Business 5.3.2.2
Closed Thread
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:57 AM.

   

 
X-Cart forums © 2001-2020