View Single Post
  #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