Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quantity Price Rules #791

Merged
merged 34 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ce58f19
implement tier_pricing
solverat Jan 18, 2019
3731d32
improve percentage calculation
solverat Jan 21, 2019
f27f852
refactor tier pricing: use tier pricing rules
solverat Jan 22, 2019
84d4d37
implement tier price calculator
solverat Jan 23, 2019
4d6d03f
improve tier price calculation, fetch extjs ids in rule manager
solverat Jan 23, 2019
9d50b89
implement range calculation, range ux improvements
solverat Jan 23, 2019
031bf11
fix percentage calculation
solverat Jan 23, 2019
9fdd6dc
implement clipboard manager to allow copy / paste or ranges
solverat Jan 25, 2019
bd5aa09
improve inheritance state
solverat Jan 25, 2019
0e44c8e
fix condition id mapping
solverat Jan 25, 2019
d07ee7b
implement pricing behaviour
solverat Jan 28, 2019
85d27d6
remove debug comments
solverat Jan 28, 2019
127a1eb
update migration
solverat Jan 28, 2019
0c0ff6a
refactor tier-pricing to move stuff into core and decouple from product
dpfaffenbauer Jan 28, 2019
7f3abb9
[TierPricing] fix readme
dpfaffenbauer Jan 28, 2019
a5d030b
implement currency aware tier range prices
solverat Jan 28, 2019
c2cfad8
copy currency on new tier row addition
solverat Jan 28, 2019
f6de4e1
remove legacy debug code
solverat Jan 28, 2019
aee93c6
implement migration, improve usability
solverat Jan 29, 2019
13109aa
[WIP][TierPricing] decouple from tier-pricing bundle to core and allo…
dpfaffenbauer Jan 29, 2019
5ffe027
[WIP][TierPricing] decouple from tier-pricing bundle to core - remove…
dpfaffenbauer Jan 30, 2019
36c7035
[TierPricing] code-style fixes
dpfaffenbauer Jan 30, 2019
8f19e21
[TierPricing] stan fixes
dpfaffenbauer Jan 30, 2019
c171cde
[TierPricing] add behat tests
dpfaffenbauer Jan 30, 2019
6e06c09
implement action validation, fix behaviour naming mismatch
solverat Jan 31, 2019
70975a4
implement action validation constraints, remove internal action valid…
solverat Jan 31, 2019
01f0bb1
rename tier price rules to product quantity price rules
solverat Feb 7, 2019
7d128cf
add split and raw doc files
dpfaffenbauer Feb 7, 2019
4bdc1a4
fix behat tests
solverat Feb 7, 2019
964a085
implement calculation type registry
solverat Feb 8, 2019
8669648
small fixes
solverat Feb 9, 2019
3ff953e
improve calculation naming, remove perItem calculation method
solverat Feb 11, 2019
0341ed5
fix twig template helper reference
solverat Feb 11, 2019
77414ec
implement notfound exceptions
solverat Feb 12, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/subtree-split
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ split 'src/CoreShop/Component/StorageList' storage-list
split 'src/CoreShop/Component/Inventory' inventory
split 'src/CoreShop/Component/SEO' seo
split 'src/CoreShop/Component/Tracking' tracking
split 'src/CoreShop/Component/ProductQuantityPriceRules' product-quantity-price-rules

split 'src/CoreShop/Bundle/AddressBundle' address-bundle
split 'src/CoreShop/Bundle/ConfigurationBundle' configuration-bundle
Expand Down Expand Up @@ -148,4 +149,5 @@ split 'src/CoreShop/Bundle/InventoryBundle' inventory-bundle
split 'src/CoreShop/Bundle/WorkflowBundle' workflow-bundle
split 'src/CoreShop/Bundle/SEOBundle' seo-bundle
split 'src/CoreShop/Bundle/PimcoreBundle' pimcore-bundle
split 'src/CoreShop/Bundle/ThemeBundle' theme-bundle
split 'src/CoreShop/Bundle/ThemeBundle' theme-bundle
split 'src/CoreShop/Bundle/ProductQuantityPriceRulesBundle' product-quantity-price-rules-bundle
3 changes: 3 additions & 0 deletions docs/02_Bundles/Product_Quantity_Price_Rules_Bundle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CoreShop Product Quantity Price Rules Bundle

Bundle for Quantity Price Rules.
3 changes: 3 additions & 0 deletions docs/02_Components/Product_Quantity_Price_Rules_Component.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# CoreShop Product Quantity Price Rules Component

Component for Quantity Price Rules.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@product_quantity_price_rules
Feature: Adding a new product with a simple quantity price rule

Background:
Given the site operates on a store in "Austria"
Given the site has a currency "Euro" with iso "EUR"
Given I am in country "Austria"
Given the site has a product "Shoe" priced at 10000
Then the product "Shoe" should be priced at "10000"

Scenario: Add a quantity price rule with no conditions
Given adding a quantity price rule to product "Shoe" named "default-product-quantity-price-rule"
And the quantity price rule is active
And the quantity price rule has a range from 0 to 10 with behaviour percentage-decrease of 10%
Then the quantity price rule should be valid for product "Shoe"
And the product "Shoe" should be priced at "10000"
Given I add the product "Shoe" to my cart
And the cart total should be "9000" including tax
And the cart total should be "9000" excluding tax
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* CoreShop.
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) 2015-2019 Dominik Pfaffenbauer (https://www.pfaffenbauer.at)
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3)
*/

namespace CoreShop\Behat\Context\Domain;

use Behat\Behat\Context\Context;
use CoreShop\Behat\Service\SharedStorageInterface;
use CoreShop\Component\Core\Context\ShopperContextInterface;
use CoreShop\Component\Core\Model\ProductInterface;
use CoreShop\Component\Rule\Condition\RuleValidationProcessorInterface;
use CoreShop\Component\ProductQuantityPriceRules\Model\ProductQuantityPriceRuleInterface;
use Webmozart\Assert\Assert;

final class ProductQuantityPriceRuleContext implements Context
{
/**
* @var SharedStorageInterface
*/
private $sharedStorage;

/**
* @var ShopperContextInterface
*/
private $shopperContext;

/**
* @var RuleValidationProcessorInterface
*/
private $ruleValidationProcessor;

/**
* @param SharedStorageInterface $sharedStorage
* @param ShopperContextInterface $shopperContext
* @param RuleValidationProcessorInterface $ruleValidationProcessor
*/
public function __construct(
SharedStorageInterface $sharedStorage,
ShopperContextInterface $shopperContext,
RuleValidationProcessorInterface $ruleValidationProcessor
) {
$this->sharedStorage = $sharedStorage;
$this->shopperContext = $shopperContext;
$this->ruleValidationProcessor = $ruleValidationProcessor;
}

/**
* @Then /^the (quantity price rule "[^"]+") for (product "[^"]+") should be valid$/
* @Then /^the (quantity price rule) should be valid for (product "[^"]+")$/
*/
public function theSpecificPriceRuleForProductShouldBeValid(ProductQuantityPriceRuleInterface $productSpecificPriceRule, ProductInterface $product)
{
Assert::true($this->ruleValidationProcessor->isValid($product, $productSpecificPriceRule, $this->shopperContext->getContext()));
}

/**
* @Then /^the (quantity price rule "[^"]+") for (product "[^"]+") should be invalid$/
* @Then /^the (quantity price rule) should be invalid for (product "[^"]+")$/
*/
public function theSpecificPriceRuleForProductShouldBeInvalid(ProductQuantityPriceRuleInterface $productSpecificPriceRule, ProductInterface $product)
{
Assert::false($this->ruleValidationProcessor->isValid($product, $productSpecificPriceRule, $this->shopperContext->getContext()));
}
}
Loading