This module adds Buy One Get One Free (BOGO) functionality to your Magento 2.4.7 store.
- Enable/disable BOGO offers per product
- Configure eligible customer groups
- Set maximum number of free items per product
- Schedule BOGO offers with start/end dates
- Automatic stock checking
- Custom BOGO labels on products
- Compatible with Magento 2.4.7
- Supports PHP 8.2 and 8.3
# 清除composer缓存
composer clearcache
# 添加GitHub仓库(这样可以立即获取最新版本)
composer config repositories.bogo vcs https://github.com/rigdoge/magento-bogo.git
# 安装新版本
composer require "bogo/module-buyonegetone:1.4.4"
# 清理缓存并重新编译
rm -rf var/cache/* var/page_cache/* var/view_preprocessed/* var/generation/* generated/*
php bin/magento cache:clean
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
在你的 Magento 项目的根目录下运行:
# 方法 1:直接安装(推荐)
composer require bogo/module-buyonegetone
# 方法 2:如果需要指定版本
composer require bogo/module-buyonegetone:1.4.0
# 方法 3:如果遇到冲突,可以先添加依赖再更新
composer require bogo/module-buyonegetone --no-update
composer update bogo/module-buyonegetone --with-dependencies
注意:
- 确保你的
composer.json
中已经配置了https://repo.magento.com/
- 如果安装特定版本,建议使用最新的稳定版本(当前是 1.4.0)
After installation, enable the module by running:
bin/magento module:enable Bogo_BuyOneGetOne
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
Magento Version | Module Version | PHP Version |
---|---|---|
2.4.7 | 1.1.x | 8.2, 8.3 |
If you encounter any issues during installation:
-
Clear the cache:
bin/magento cache:flush
-
If you see composer conflicts, try:
# 只更新 BOGO 模块和其依赖 composer update bogo/module-buyonegetone --with-dependencies # 或者清理 composer 缓存后重试 composer clearcache composer require bogo/module-buyonegetone
-
For permission issues:
chmod -R 777 var/ generated/ pub/static/
- Fixed BOGO items not being added correctly for subsequent cart additions
- Improved handling of new item detection
- Optimized cart update logic
- Fixed issue with BOGO items not being added on subsequent cart updates
- Optimized cart item handling logic
- Removed redundant code and improved maintainability
- Major refactor: improved cart handling
- Replaced observer with plugin for better performance
- Fixed free item quantity synchronization
- Improved handling of multiple cart updates
- Fixed free item quantity calculation
- Added maximum items limit enforcement
- Fixed cart item addition issues
- Improved error handling
- Initial stable release
^1.1.0
: Installs the latest stable version >= 1.1.0 and < 2.0.0 (Recommended)~1.1.0
: Installs the latest stable version >= 1.1.0 and < 1.2.01.1.0
: Installs exactly version 1.1.0*
: Installs the latest version (including breaking changes)dev-develop
: Installs the latest development code
composer require bogo/module-buyonegetone:^1.1.0
composer require bogo/module-buyonegetone:1.1.0
composer require bogo/module-buyonegetone:dev-develop
bin/magento module:enable Bogo_BuyOneGetOne
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
composer update bogo/module-buyonegetone
This command updates the package based on the version constraint in your composer.json:
- If you have
^1.0.0
: Updates to latest 1.x.x version - If you have
~1.0.0
: Updates to latest 1.0.x version - If you have
*
: Updates to the latest version - If you have
dev-develop
: Updates to latest development code
composer require bogo/module-buyonegetone:^1.1.0
This command explicitly updates to the specified version constraint, regardless of what's in your composer.json
composer update bogo/module-buyonegetone
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
composer require bogo/module-buyonegetone:^1.1.0
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
composer require bogo/module-buyonegetone:dev-develop
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
# Disable the module
bin/magento module:disable Bogo_BuyOneGetOne
# Remove the module
composer remove bogo/module-buyonegetone
# Clean up
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
# Disable the module
bin/magento module:disable Bogo_BuyOneGetOne
# Remove module files
rm -rf app/code/Bogo/BuyOneGetOne
# Remove module from config
rm -f app/etc/config.php
bin/magento module:enable --all
# Clean up
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:clean
- Go to Admin > Stores > Configuration > Papa BOGO Extensions > Buy One Get One Free
- Enable the module and configure:
- Customer groups
- Maximum free items
- Active date range
- Display settings
- Edit a product in Admin > Catalog > Products
- Find "Enable Buy One Get One Free" under the Promotions tab
- Set to "Yes" to enable BOGO for the product
- Clear cache and generated files:
rm -rf var/cache/* var/page_cache/* generated/* bin/magento cache:clean bin/magento cache:flush
- If you see 404 errors in admin:
bin/magento setup:static-content:deploy
- If you experience any issues after uninstallation, clear all caches:
rm -rf var/cache/* var/page_cache/* generated/* bin/magento cache:clean bin/magento cache:flush
- Magento 2.4.7
- PHP ~8.2.0 || ~8.3.0
For support, please email support@tschenfeng.com
This project is licensed under the MIT License - see the LICENSE file for details.