《Ibexa DXP 折扣系统介绍.pdf》由会员分享,可在线阅读,更多相关《Ibexa DXP 折扣系统介绍.pdf(37页珍藏版)》请在三个皮匠报告上搜索。
1、Introduction to the Discounts systemin Ibexa DXPKonrad ObozaAbout myselfhttps:/ ObozaSenior Software EngineerIn Ibexa for over 7 yearsPasionate about rock climbingand road cyclingAgenda1.What ibexa/discounts is all about?2.Architectural concepts3.API overview4.How to extend?5.Example customization6.
2、Feature future;)RulesQuestions will be answered at the end of the session1.What is ibexa/discounts?4.6 LTS update:available for Ibexa Commerce tieropt-in packagebuilds on top of:ibexa/cart,ibexa/checkout,ibexa/storefront,ibexa/product-catalog and ibexa/order-management2.Architectural conceptsSymfony
3、 Expression Languagepublic function getExpression():stringreturn currency.getCode()=code;public function getExpression():stringreturn is_user_in_customer_group(user,customer_group);public function getExpression():stringreturn summary.getTotalPrice().getAmount()=minimal_purchase_amount;put logic into
4、 an existing expression notationcomputing on the server side instead of painful database queryingeasier to extendsupports cachingfits scenario where discount object needs to meet specific conditionshandles even very complex logic Expression ProviderExpression Providerfinal class ExpressionLanguagePr
5、ovider implements ExpressionFunctionProviderInterfacepublic function getFunctions():arrayreturn new ExpressionFunction(is_user_in_customer_group,static function():string return is_user_in_customer_group(user,customer_group);,$this,isUserInCustomerGroup),;public function isUserInCustomerGroup(array$a
6、rguments):bool$customerGroup=$argumentscustomer_group;$user=$argumentsuser;/checking the above parameters via API()return true;Rules vs Conditions?Differencesthe way discount is calculated is shaped by rulediscount needs to meet all the conditions to be selectedrule is calculated to return the final