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. |
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 |
Re: Default Product Values
1 Attachment(s)
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. |
Re: Default Product Values
That worked! Thank you very much Alex!
|
All times are GMT -8. The time now is 01:09 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.