| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Default Product Values | ||||
|
|
Thread Tools | Search this Thread |
#21
|
|||||||||
|
|||||||||
Re: Default Product Values
Quote:
You don't need a reference. But did you enable your custom module on the Modules page in the back end? Also, did you replace "DEV_ID" with "JRG", and "MODULE_ID" with "Quantity" in the module's source code? You may also check if there is product.php file in the var/run/classes/XLite/Module/JRG/Quantity/Model/ directory and whether it is not empty.
__________________
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 |
|||||||||
#22
|
|||||||
|
|||||||
Re: Default Product Values
Here is the product.php file located in /opt/bitnami/apps/xcart/htdocs/classes/XLite/Module/JRG/Quantity/Model
// File: classes/XLite/Module/JRG/Quantity/Model/Product.php namespace XLite\Module\JRG\Quantity\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; } } Here is the main.php file located in /opt/bitnami/apps/xcart/htdocs/classes/XLite/Module/JRG/Quantity <?php namespace XLite\Module\JRG\Quantity; abstract class Main extends \XLite\Module\AModule { /** * Just Retro Games * * @return string */ public static function getAuthorName() { return 'Just Retro Games'; } /** * Module name * * @return string */ public static function getModuleName() { return 'Default Item Quantity'; } /** * Get module major version * * @return string */ public static function getMajorVersion() { return '5.3'; } /** * Module version * * @return string */ public static function getMinorVersion() { return 0; } /** * Module description * * @return string */ public static function getDescription() { return 'Sets the default item quantity to 1 instead of 1000'; } There is no model subfolder in this directory. /opt/bitnami/apps/xcart/htdocs/var/run/classes/XLite/Module/JRG/Quantity
__________________
David X-Cart Business 5.3.2.2 |
|||||||
#23
|
|||||||||
|
|||||||||
Re: Default Product Values
Quote:
It sounds as you missed the "<?php" in the first line in that file, so XC5 doesn't consider this as a PHP script and ignores it. Anyway, I've tried the code on my local installation and I see that overriding the method is not enough. You should also change \XLite\Model\Product::__constructor($data) as the $amount property is initialised with the constant, not with the value returned by the method. So, you should override it in the constructor as well. Please check the attached custom module - it should work for you.
__________________
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 |
|||||||||
|
#24
|
|||||||
|
|||||||
Re: Default Product Values
That worked! Thank you very much Alex!
__________________
David X-Cart Business 5.3.2.2 |
|||||||
|
|||
X-Cart forums © 2001-2020
|