Commit b7fd20df authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_advanced_ecommerce: improvements

support promotional code

display nicely
parent 010d4a6b
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>shop</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Shop</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>discounted</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Discounted</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_folders_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>coupon</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Coupon</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,11 +3,12 @@
minimal_quantity python: getattr(supply_line, 'additional_service_min_quantity', None);
">
<tal:block tal:condition="python: additional_service is not None">
<label tal:content='python: additional_service.getDescription()'></label>
<label tal:content='python: additional_service.getTranslatedDescription()'></label>
<div class="input" style="display: inline-block;">
<input name="field_your_additional_service_quantity"
tal:attributes='min python: minimal_quantity;
value python: minimal_quantity;'>
<p style="display: inline;" tal:content='python: additional_service.getQuantityUnitTranslatedTitle()'></p>
</div>
</tal:block>
</tal:block>
\ No newline at end of file
price_currency_value = context.getWebSiteValue().WebSite_getShoppingCartDefaultCurrency()
return context.portal_catalog(
portal_type='Sale Supply Line',
resource_relative_url = context.getRelativeUrl(),
price_currency_relative_url = price_currency_value.getRelativeUrl(),
limit=1)[0]
web_site = context.REQUEST.get('current_web_site', context.getWebSiteValue())
price_currency_value = web_site.WebSite_getShoppingCartDefaultCurrency()
variation = context.REQUEST.get('variation', None)
if not variation or (context.getRelativeUrl() not in variation):
result = context.portal_catalog(
portal_type='Sale Supply Line',
resource_relative_url = context.getRelativeUrl(),
price_currency_relative_url = price_currency_value.getRelativeUrl(),
limit=1)
else:
result = context.portal_catalog(
portal_type='Sale Supply Cell',
variation_relative_url = variation,
resource_relative_url = context.getRelativeUrl(),
price_currency_relative_url = price_currency_value.getRelativeUrl(),
limit=1)
if result:
return result[0]
return None
......@@ -30,6 +30,28 @@ if form_id is not None:
return form(request)
session_id = request.get('session_id', None)
promotional_code = request.get('field_your_promotional_code', None)
# get category like size and variation
category = request.form.get('field_variation_box_your_category', '')
if category:
[base_category, category] = category.split('/', 1)
variation = request.form.get('field_variation_box_your_variation', None)
keep_items = {}
if variation:
keep_items['variation'] = variation
if context.getPortalType() == 'Product':
redirect_view = "Resource_viewAsShop"
else:
redirect_view = "view"
if promotional_code:
sale_trade_condition = context.WebSection_getPromotionalCodeTrade(promotional_code)
if not sale_trade_condition:
keep_items['portal_status_message'] = context.Base_translateString("Invalide Promotional Code.")
return context.Base_redirect(redirect_view, keep_items=keep_items)
if session_id in [None, '']:
# Rely on cookies information
session_id = request.cookies.get('session_id', None)
......@@ -39,17 +61,13 @@ if session_id in [None, '']:
now = DateTime()
session_id = context.Base_generateSessionID(max_long=20)
expire_timeout_days = 90
request.RESPONSE.setCookie('session_id', session_id,
request.RESPONSE.setCookie('session_id', session_id,
expires=(now + expire_timeout_days).rfc822(), path='/')
request.set('session_id', session_id)
shopping_cart = context.SaleOrder_getShoppingCart()
shopping_cart_items = context.SaleOrder_getShoppingCartItemList()
# get category like size and variation
category = request.form.get('field_variation_box_your_category', '')
if category:
[base_category, category] = category.split('/', 1)
variation = request.form.get('field_variation_box_your_variation', None)
## check if we don't have already such a resource in cart
line_found=False
for order_line in shopping_cart_items:
......@@ -102,7 +120,8 @@ if not line_found:
# set aggregate so we know it's who's additional service
additional_order_line.setAggregate(variation or context.getRelativeUrl())
context.WebSection_updateShoppingCartTradeCondition(shopping_cart, None)
shopping_cart.edit(promotional_code=promotional_code)
context.WebSection_updateShoppingCartTradeCondition(shopping_cart, None, promotional_code=promotional_code)
context.getPortalObject().portal_sessions[session_id].update(shopping_cart=shopping_cart)
if checkout:
......@@ -111,13 +130,8 @@ if checkout:
return website.cart.Base_redirect("",
keep_items={'portal_status_message':context.Base_translateString("Added to cart.")})
keep_items = {
'portal_status_message':context.Base_translateString("Added to cart.")}
if variation:
keep_items['variation'] = variation
if( context.getPortalType() == 'Product'):
context.Base_redirect('Resource_viewAsShop',
keep_items=keep_items)
else:
context.Base_redirect('view',
keep_items['portal_status_message'] = context.Base_translateString("Added to cart.")
context.Base_redirect(redirect_view,
keep_items=keep_items)
......@@ -20,7 +20,7 @@ if currency == 'EUR':
elif currency == 'CNY':
currency = '¥'
output = """%s<br /><br />""" % (title.upper(),)
output = """%s<br /><br />""" % (title,)
#if old_price is not None and price != old_price:
# output += """<span class="new_price">%s %s</span>""" % (price, currency)
......
supply = context.Product_getSaleSupplyLine()
if supply:
return getattr(supply, 'base_price')
return None
"""
#this search all supply, too slow
return context.getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"],
context=context.Resource_getPriceCalculationDefaultContext())
"""
......@@ -108,6 +108,7 @@
<string>my_price</string>
<string>my_old_price</string>
<string>your_additional_service</string>
<string>your_promotional_code</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="StringField" module="Products.Formulator.StandardFields"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>your_promotional_code</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
<item>
<key> <string>required_not_found</string> </key>
<value> <string>Input is required but no input given.</string> </value>
</item>
<item>
<key> <string>too_long</string> </key>
<value> <string>Too much input was given.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_maxwidth</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>40</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>external_validator</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>extra</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>input_type</string> </key>
<value> <string>text</string> </value>
</item>
<item>
<key> <string>max_length</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Promotional Code</string> </value>
</item>
<item>
<key> <string>truncate</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>unicode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>whitespace_preserve</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: getattr(here.SaleOrder_getShoppingCart(), \'promotional_code\', \'\')</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
This will return all Products that have set product_line='shipping'. XXX
Such products are used for shipping purposes i.e. they can not be sold.
"""
portal = context.getPortalObject()
only_small_product = False
if only_small_product:
shipping_product_line_category_uid = portal.portal_categories.product_line.shipping.ship_small_product.getUid()
else:
shipping_product_line_category_uid = [x.getUid() for x in portal.portal_categories.product_line.shipping.contentValues() if x.getId() != 'ship_small_product']
return [r.getObject() for r in portal.portal_catalog(
limit=10,
product_line_uid=shipping_product_line_category_uid,
portal_type=portal.getPortalResourceTypeList())]
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_Change_Python_Scripts_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_bindings_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_cache_settings_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_permissions_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Change_proxy_roles_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Copy_or_Move_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Delete_objects_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Manage_WebDAV_Locks_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Manage_properties_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Take_ownership_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_Undo_changes_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_History_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_View_management_screens_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_Lock_items_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_Unlock_items_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_WebDAV_access_Permission</string> </key>
<value>
<list>
<string>Manager</string>
</list>
</value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_getAvailableShippingResourceList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Get list of available shipping methods</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
return 0
"""
return round(sum([i.getTotalPrice() for i in context.getAggregatedAmountList(rounding=True)
if "base_amount/loyalty_program/discount" in i.getBaseApplicationList() or "base_amount/loyalty_program/coupon" in i.getBaseApplicationList()]), 2)
"""
return round(sum([i.getTotalPrice() for i in context.getAggregatedAmountList(rounding=True) if "base_amount/shop/discounted/coupon" in i.getBaseApplicationList()]), 2)
if promotional_code:
trade_condition_reference = "%s-%s" % (context.restrictedTraverse(context.WebSection_getDefaultTradeCondition()).getReference(), promotional_code)
sale_trade_condition = context.portal_catalog(
portal_type='Sale Trade Condition',
reference=trade_condition_reference,
validation_state=('published','validated'),
limit=1,
sort_on=(('version', 'descending'),))
if sale_trade_condition:
return sale_trade_condition[0]
return None
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>promotional_code</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebSection_getPromotionalCodeTrade</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Update Trade Condition with the appropriated Trade Condition.
"""
shopping_cart.setSpecialise(context.WebSection_getDefaultTradeCondition())
if promotional_code:
trade_condition = context.WebSection_getPromotionalCodeTrade(promotional_code)
if trade_condition:
shopping_cart.setSpecialiseValue(trade_condition)
else:
if not shopping_cart.getSpecialise():
shopping_cart.setSpecialise(context.WebSection_getDefaultTradeCondition())
portal = context.getPortalObject()
portal.portal_sessions[container.REQUEST['session_id']].update(shopping_cart=shopping_cart)
return
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>shopping_cart, payment_mode, preserve=False</string> </value>
<value> <string>shopping_cart, payment_mode, promotional_code=None, preserve=False</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -363,7 +363,7 @@ border:1px solid #000;
.cyan {background: #00FFFF}
.choice_box{margin-left: 20px; margin-top:30px;}
.choice_box input[type="text"] {width:30px;
.choice_box input[type="text"] {
border:1px solid #000;
height: 17px;
padding:2px;}
......
......@@ -89,7 +89,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
</tal:block-->
<div class="clear"></div>
<div class="choice_box">
<tal:block tal:define="field nocall:form/your_additional_service">
<tal:block metal:use-macro="field_render" />
</tal:block>
<br>
<tal:block tal:define="field nocall:form/your_promotional_code">
<tal:block metal:use-macro="field_render" />
</tal:block>
<br>
<tal:block tal:define="field nocall:form/variation_box">
<tal:block metal:use-macro="field_render" />
</tal:block>
......@@ -98,9 +105,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<br/>
<!--tal:block tal:define="is_unavailable python: here.Resource_getInventoryStatus(request.get('variation', None)) == 'UNAVAILABLE'"-->
<tal:block tal:define="field nocall:form/your_additional_service">
<tal:block metal:use-macro="field_render" />
</tal:block>
<tal:block tal:define="field nocall:form/your_buy_quantity">
<tal:block metal:use-macro="field_render" />
......
portal_categories/base_amount/shop
portal_categories/base_amount/shop/**
portal_categories/role/client/shop
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment