Commit 0c68a3e4 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_advanced_ecommerce: purchase additional service and remove useless

code
parent 7004a665
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_view</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_view</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>additional_service</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>3.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Additional Service</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SaleSupplyLine_viewAdditionalService</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base 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>acquisition_append_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_copy_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>acquisition_mask_value</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>acquisition_object_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_portal_type</string> </key>
<value> <string>python: []</string> </value>
</item>
<item>
<key> <string>acquisition_sync_value</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>aggregate</string>
<string>additional_service</string>
</tuple>
</value>
</item>
<item>
<key> <string>category_type</string> </key>
<value>
<tuple>
<string>sub_variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>fallback_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>additional_service</string> </value>
</item>
<item>
<key> <string>id_generator</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id_group</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Category</string> </value>
</item>
<item>
<key> <string>read_permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>rid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>short_title</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Additional Service</string> </value>
</item>
<item>
<key> <string>write_permission</string> </key>
<value>
<none/>
</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>
<base_category_list> <base_category_list>
<portal_type id="Sale Supply Line">
<item>additional_service</item>
</portal_type>
<portal_type id="Web Site"> <portal_type id="Web Site">
<item>specialise</item> <item>specialise</item>
</portal_type> </portal_type>
......
<?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></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>Order_getLinkIndex</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<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_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Product_getAdditionalService</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block tal:define="supply_line python: context.Product_getSaleSupplyLine();
additional_service python: supply_line.getAdditionalServiceValue();
minimal_quantity python: getattr(supply_line, 'additional_service_min_quantity');
">
<tal:block tal:condition="python: additional_service is not None">
<label tal:content='python: additional_service.getDescription()'></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;'>
</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]
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Product_getSaleSupplyLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
Add resource to shopping cart.
TODO:
- support generic variations beyond size and variation
(through introspection of resource) also in
SaleOrder_viewShoppingCartRenderer and
SaleOrder_viewShoppingCartWidgetRenderer
- implement form validation and parameter retrieval using Base_edit
- Resource_viewAsShop should be select through portal types
"""
from DateTime import DateTime from DateTime import DateTime
request = container.REQUEST request = container.REQUEST
if resource is None: if resource is None:
...@@ -17,11 +6,16 @@ if form_id is not None: ...@@ -17,11 +6,16 @@ if form_id is not None:
from Products.Formulator.Errors import FormValidationError from Products.Formulator.Errors import FormValidationError
form = getattr(context, form_id, None) form = getattr(context, form_id, None)
quantity = int(request.get('field_your_buy_quantity')) quantity = int(request.get('field_your_buy_quantity'))
additional_service_quantity = int(request.get('field_your_additional_service_quantity', '0'))
# FIXME: # FIXME:
# this handling of validation errors should be automatically handled by the # this handling of validation errors should be automatically handled by the
# button itself # button itself
try: try:
form.validate_all_to_request(request) form.validate_all_to_request(request)
sale_supply_line = context.Product_getSaleSupplyLine()
additional_min_quantity = getattr(sale_supply_line, "additional_service_min_quantity", 0)
if additional_min_quantity and additional_service_quantity < additional_min_quantity:
raise FormValidationError("", "")
except FormValidationError, validation_errors: except FormValidationError, validation_errors:
# Pack errors into the request # Pack errors into the request
field_errors = form.ErrorFields(validation_errors) field_errors = form.ErrorFields(validation_errors)
...@@ -36,7 +30,6 @@ if form_id is not None: ...@@ -36,7 +30,6 @@ if form_id is not None:
return form(request) return form(request)
session_id = request.get('session_id', None) session_id = request.get('session_id', None)
if session_id in [None, '']: if session_id in [None, '']:
# Rely on cookies information # Rely on cookies information
session_id = request.cookies.get('session_id', None) session_id = request.cookies.get('session_id', None)
...@@ -49,7 +42,6 @@ if session_id in [None, '']: ...@@ -49,7 +42,6 @@ if session_id in [None, '']:
request.RESPONSE.setCookie('session_id', session_id, request.RESPONSE.setCookie('session_id', session_id,
expires=(now + expire_timeout_days).rfc822(), path='/') expires=(now + expire_timeout_days).rfc822(), path='/')
request.set('session_id', session_id) request.set('session_id', session_id)
shopping_cart = context.SaleOrder_getShoppingCart() shopping_cart = context.SaleOrder_getShoppingCart()
shopping_cart_items = context.SaleOrder_getShoppingCartItemList() shopping_cart_items = context.SaleOrder_getShoppingCartItemList()
...@@ -68,6 +60,16 @@ for order_line in shopping_cart_items: ...@@ -68,6 +60,16 @@ for order_line in shopping_cart_items:
# We don't update quantities if it is a direct checkout. # We don't update quantities if it is a direct checkout.
break break
new_quantity = int(order_line.getQuantity()) + quantity new_quantity = int(order_line.getQuantity()) + quantity
# update related additional service line
if additional_service_quantity:
for additional_line in shopping_cart_items:
if additional_line.getAggregate() == order_line.Order_getLinkIndex():
if new_quantity <= 0:
shopping_cart.manage_delObjects(order_line)
else:
additional_line.setQuantity(new_quantity * additional_service_quantity)
break
if new_quantity <= 0: if new_quantity <= 0:
## remove items with zero quantity ## remove items with zero quantity
shopping_cart.manage_delObjects(order_line) shopping_cart.manage_delObjects(order_line)
...@@ -75,6 +77,7 @@ for order_line in shopping_cart_items: ...@@ -75,6 +77,7 @@ for order_line in shopping_cart_items:
order_line.setQuantity(new_quantity) order_line.setQuantity(new_quantity)
break break
if not line_found: if not line_found:
## new Resource so add it to shopping cart ## new Resource so add it to shopping cart
order_line = shopping_cart.newContent(portal_type='Sale Order Line') order_line = shopping_cart.newContent(portal_type='Sale Order Line')
...@@ -87,14 +90,25 @@ if not line_found: ...@@ -87,14 +90,25 @@ if not line_found:
method_id = getattr(order_line,'set%s' % base_category.title()) method_id = getattr(order_line,'set%s' % base_category.title())
method_id(category) method_id(category)
order_line.setPrice(context.getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"], context=order_line)) order_line.setPrice(context.getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"], context=order_line))
context.WebSection_updateShoppingCartTradeCondition(shopping_cart, None) # it has additional service so create a line for it
if additional_service_quantity:
sale_supply_line = context.Product_getSaleSupplyLine()
additional_service_value = sale_supply_line.getAdditionalServiceValue()
additional_order_line = shopping_cart.newContent(portal_type='Sale Order Line')
additional_order_line.setResource(additional_service_value.getRelativeUrl())
additional_order_line.setQuantity(additional_service_quantity * quantity)
additional_order_line.setBaseContributionList(resource.getBaseContributionList())
additional_order_line.setPrice(additional_service_value.getPrice(supply_path_type=["Sale Supply Line", "Sale Supply Cell"], context=additional_order_line))
# 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)
context.getPortalObject().portal_sessions[session_id].update(shopping_cart=shopping_cart) context.getPortalObject().portal_sessions[session_id].update(shopping_cart=shopping_cart)
if checkout: if checkout:
website = context.getWebSiteValue() website = context.getWebSiteValue()
if website is not None: if website is not None:
return website.cart.Base_redirect("", 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.")})
keep_items = { keep_items = {
......
...@@ -10,7 +10,6 @@ portal_categories = context.portal_categories ...@@ -10,7 +10,6 @@ portal_categories = context.portal_categories
result = [] result = []
for item in item_list: for item in item_list:
stock_status = context.Resource_getInventoryStatus(variation=variation, category=item) stock_status = context.Resource_getInventoryStatus(variation=variation, category=item)
context.log(item)
title = "%s (%s)" % (portal_categories.restrictedTraverse(item).getTranslatedTitle(), context.Base_translateString(stock_status_message[stock_status])) title = "%s (%s)" % (portal_categories.restrictedTraverse(item).getTranslatedTitle(), context.Base_translateString(stock_status_message[stock_status]))
result.append((title, item)) result.append((title, item))
return result return result
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
"AVAILABLE": Not in stock, but it will be available soon. "AVAILABLE": Not in stock, but it will be available soon.
"UNAVAILABLE": Not in stock neither to arrive. "UNAVAILABLE": Not in stock neither to arrive.
""" """
return 'AVAILABLE'
node_uid = [x.getUid() for x in context.getSpecialiseValueList()] node_uid = [x.getUid() for x in context.getSpecialiseValueList()]
kw = {"resource_uid": context.getUid(), kw = {"resource_uid": context.getUid(),
......
...@@ -3,13 +3,16 @@ DRESSING DAILS<br />By TOM TAYLOR<br /> ...@@ -3,13 +3,16 @@ DRESSING DAILS<br />By TOM TAYLOR<br />
<span class="price">14,89 &euro;</span> <span class="price">14,89 &euro;</span>
<span class="old_price">29,95 &euro;</span> <span class="old_price">29,95 &euro;</span>
""" """
if not context.getWebSiteValue():
return
clean = 0 clean = 0
if context.REQUEST.get("variation", None) is None: if context.REQUEST.get("variation", None) is None:
context.REQUEST.set("variation", context.REQUEST.get("default_displayed_variation")) context.REQUEST.set("variation", context.REQUEST.get("default_displayed_variation"))
clean = 1 clean = 1
price = cell.Resource_getShopPrice() price = cell.Resource_getShopPrice()
old_price = cell.getDefaultSaleSupplyLineBasePrice() #old_price = cell.getDefaultSaleSupplyLineBasePrice()
currency = here.WebSite_getShoppingCartDefaultCurrencyCode() currency = here.WebSite_getShoppingCartDefaultCurrencyCode()
title = cell.getTitle() title = cell.getTitle()
if currency == 'EUR': if currency == 'EUR':
...@@ -19,11 +22,12 @@ elif currency == 'CNY': ...@@ -19,11 +22,12 @@ elif currency == 'CNY':
output = """%s<br /><br />""" % (title.upper(),) output = """%s<br /><br />""" % (title.upper(),)
if old_price is not None and price != old_price: #if old_price is not None and price != old_price:
output += """<span class="new_price">%s %s</span>""" % (price, currency) # output += """<span class="new_price">%s %s</span>""" % (price, currency)
output += """<br /><span class="old_price">%s %s</span>""" % (old_price, currency) # output += """<br /><span class="old_price">%s %s</span>""" % (old_price, currency)
else: #else:
output += """<span class="price">%s %s</span>""" % (price, currency) # output += """<span class="price">%s %s</span>""" % (price, currency)
output += """<span class="price">%s %s</span>""" % (price, currency)
if clean: if clean:
context.REQUEST.set("variation", None) context.REQUEST.set("variation", None)
......
...@@ -107,6 +107,7 @@ ...@@ -107,6 +107,7 @@
<string>social_box</string> <string>social_box</string>
<string>my_price</string> <string>my_price</string>
<string>my_old_price</string> <string>my_old_price</string>
<string>your_additional_service</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -146,9 +146,7 @@ ...@@ -146,9 +146,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -236,7 +234,7 @@ ...@@ -236,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -296,17 +294,4 @@ ...@@ -296,17 +294,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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: not here.Resource_getWebShopImageURL()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -72,9 +72,7 @@ ...@@ -72,9 +72,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -150,17 +148,4 @@ ...@@ -150,17 +148,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Resource_getWebShopImageURL()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -144,9 +144,7 @@ ...@@ -144,9 +144,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -225,7 +223,7 @@ ...@@ -225,7 +223,7 @@
</item> </item>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>external_validator</string> </key> <key> <string>external_validator</string> </key>
...@@ -286,21 +284,4 @@ ...@@ -286,21 +284,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string encoding="cdata"><![CDATA[
python: here.getDefaultSaleSupplyLineBasePrice() < here.Resource_getShopPrice()
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<tal:block tal:define="variation python:request.get('variation', None); <div class="available_stock" i18n:translate="" i18n:domain="ui"> Available </div>
inventory_status python: here.Resource_getInventoryStatus(variation=variation)"> \ No newline at end of file
<tal:block tal:condition="python: inventory_status == 'STOCK'">
<div class="in_stock" i18n:translate="" i18n:domain="ui"> In Stock </div>
</tal:block>
<tal:block tal:condition="python: inventory_status == 'AVAILABLE'">
<div class="available_stock" i18n:translate="" i18n:domain="ui"> Available </div>
</tal:block>
<tal:block tal:condition="python: inventory_status == 'UNAVAILABLE'">
<div class="unavailable_stock" i18n:translate="" i18n:domain="ui"> Sold Out </div>
</tal:block>
</tal:block>
\ No newline at end of file
<div class="social_box"> <div class="social_box">
<div class="facebook_box"> <!--div class="facebook_box">
<iframe tal:attributes="src here/Resource_getFacebookLikeURL" <iframe tal:attributes="src here/Resource_getFacebookLikeURL"
scrolling="no" frameborder="0" allowTransparency="true" scrolling="no" frameborder="0" allowTransparency="true"
style="border:none; overflow:hidden; width:90px; height:21px;"> </iframe> style="border:none; overflow:hidden; width:90px; height:21px;"> </iframe>
</div> </div-->
<div class="tweet_box"> <div class="tweet_box">
<a href="https://twitter.com/share" class="twitter-share-button" <a href="https://twitter.com/share" class="twitter-share-button"
tal:attributes="data-url here/absolute_url" i18n:translate="" i18n:domain="ui">Tweet</a> tal:attributes="data-url here/absolute_url" i18n:translate="" i18n:domain="ui">Tweet</a>
......
"""
Delete a shopping cart item.
"""
portal = context.getPortalObject()
translateString = portal.Base_translateString
shopping_cart = context.SaleOrder_getShoppingCart()
if field_my_order_line_id_list is not None:
shopping_cart.manage_delObjects(ids=field_my_order_line_id_list)
portal_status_message = "Successfully removed from shopping cart."
else:
portal_status_message = "Please select an item."
portal.portal_sessions[container.REQUEST['session_id']].update(shopping_cart=shopping_cart)
context.Base_redirect(form_id, \
keep_items={'portal_status_message': translateString(portal_status_message, mapping={})})
<?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>field_my_order_line_id_list = None,form_id=\'SaleOrder_viewAsWeb\'</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_deleteShoppingCartItem</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Delete a shopping cart item</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
total_discount = context.SaleOrder_getTotalDiscount() total_discount = context.SaleOrder_getTotalDiscount()
total_tax = context.SaleOrder_getTotalTax() total_tax = context.SaleOrder_getTotalTax()
if context.ERP5Site_getAuthenticatedMemberPersonValue(): #if context.ERP5Site_getAuthenticatedMemberPersonValue():
return context.getTotalPrice() + total_discount + total_tax return context.getTotalPrice() + total_discount + total_tax
return context.getTotalPrice() + total_discount #return context.getTotalPrice() + total_discount
item_list = context.SaleOrder_getShoppingCartItemList()
order_list = []
aggregate_dict = {}
for item in item_list:
aggregate = item.getAggregate()
if aggregate:
if aggregate not in aggregate_dict:
aggregate_dict[aggregate] = item
else:
order_list.append(item)
new_order_list = []
for order in order_list:
link_index = order.Order_getLinkIndex()
if link_index in aggregate_dict:
new_order_list.append([order, aggregate_dict[link_index]])
else:
new_order_list.append([order])
return new_order_list
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_getShoppingCartItemWithAdditionalServiceList</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -17,11 +17,13 @@ if sale_order is None: ...@@ -17,11 +17,13 @@ if sale_order is None:
if discount: if discount:
total = sale_order.SaleOrder_getFinalPrice() total = sale_order.SaleOrder_getFinalPrice()
else: else:
total = sale_order.getTotalPrice() + context.SaleOrder_getTotalTax()
"""
if context.ERP5Site_getAuthenticatedMemberPersonValue(): if context.ERP5Site_getAuthenticatedMemberPersonValue():
total = sale_order.getTotalPrice() + context.SaleOrder_getTotalTax() total = sale_order.getTotalPrice() + context.SaleOrder_getTotalTax()
else: else:
total = sale_order.getTotalPrice() total = sale_order.getTotalPrice()
"""
if not include_shipping: if not include_shipping:
shipping_method = getattr(sale_order, 'shipping_method', None) shipping_method = getattr(sale_order, 'shipping_method', None)
......
total_tax = round(sum([i.getTotalPrice() for i in context.getAggregatedAmountList()
if "base_amount/trade/base/taxable/vat/vat_normal_rate" in i.getBaseApplicationList()]), 2)
return total_tax
ratio = None ratio = None
ceiling = None ceiling = None
specialise_value = context.getSpecialiseValue() specialise_value = context.getSpecialiseValue()
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
portal_path python:web_site.absolute_url(); portal_path python:web_site.absolute_url();
current_url request/URL; current_url request/URL;
currency_code web_site/WebSite_getShoppingCartDefaultCurrencyCode; currency_code web_site/WebSite_getShoppingCartDefaultCurrencyCode;
shopping_cart_item_list shopping_cart/SaleOrder_getShoppingCartItemList; shopping_cart_item_list shopping_cart/SaleOrder_getShoppingCartItemWithAdditionalServiceList;
shipping here/SaleOrder_getSelectedShippingResource; shipping here/SaleOrder_getSelectedShippingResource;
discount shopping_cart/SaleOrder_getTotalDiscount; discount shopping_cart/SaleOrder_getTotalDiscount;
total_tax python: shopping_cart.SaleOrder_getTotalTax(); total_tax python: shopping_cart.SaleOrder_getTotalTax();
...@@ -21,16 +21,14 @@ ...@@ -21,16 +21,14 @@
</tr> </tr>
<tal:block tal:repeat="order_line shopping_cart_item_list"> <tal:block tal:repeat="order_line shopping_cart_item_list">
<tr tal:define="resource python: here.restrictedTraverse(order_line.getResource()); <tr tal:define="resource python: here.restrictedTraverse(order_line[0].getResource());
quantity python: int(order_line.getQuantity()); quantity python: int(order_line[0].getQuantity());">
price python: order_line.getPrice();
order_line_id python: order_line.getId();">
<td class="shipping_cart_resource"> <td class="shipping_cart_resource">
<div tal:attributes="class string: shopping_cart_renderer_title" <div tal:attributes="class string: shopping_cart_renderer_title"
tal:define="variation_dict python: order_line.DeliveryLine_getVarationDict(); tal:define="variation_dict python: order_line[0].DeliveryLine_getVarationDict();
variation python: variation_dict.pop('variation', None); variation python: variation_dict.pop('variation', None);
variation_title python: variation_dict.pop('variation_title', None); variation_title python: variation_dict.pop('variation_title', None);
option_title python: getattr(order_line, 'get%sTitle' % resource.getVariationBaseCategory().title())() if resource.getVariationBaseCategory() else ''"> option_title python: getattr(order_line[0], 'get%sTitle' % resource.getVariationBaseCategory().title())() if resource.getVariationBaseCategory() else ''">
<a tal:condition="python: variation" href="" tal:attributes="href python: '%s/%s?variation=%s' % <a tal:condition="python: variation" href="" tal:attributes="href python: '%s/%s?variation=%s' %
(resource.absolute_url(), 'Resource_viewAsShop', variation);"> (resource.absolute_url(), 'Resource_viewAsShop', variation);">
<span tal:replace="resource/getTitle"/> <span tal:replace="resource/getTitle"/>
...@@ -41,10 +39,10 @@ ...@@ -41,10 +39,10 @@
</a> </a>
<span tal:content="variation_title" tal:condition="variation_title"/> <span tal:content="variation_title" tal:condition="variation_title"/>
<span tal:content="option_title" tal:condition="option_title"/> <span tal:content="option_title" tal:condition="option_title"/>
<span tal:content='python: "+ %s x %s" % (order_line[1].getQuantity() / order_line[0].getQuantity(), order_line[1].getResourceTitle())' tal:condition="python: len(order_line) == 2"/>
</div> </div>
<div class="shopping_cart_renderer_remove"> <div class="shopping_cart_renderer_remove">
<a tal:attributes="href python: '%s/SaleOrder_deleteShoppingCartItem?field_my_order_line_id=%s&form_id=WebSection_viewShoppingCart' <a tal:attributes="href python: '%s/SaleOrder_deleteShoppingCartItem?form_id=WebSection_viewShoppingCart' % here.absolute_url() + ''.join(['&field_my_order_line_id_list:list=%s' % x.getId() for x in order_line])">
%(here.absolute_url(), order_line_id)">
<img src="mf54_image/icon_remove.gif" title="Remove from shopping cart"/> <img src="mf54_image/icon_remove.gif" title="Remove from shopping cart"/>
</a> </a>
</div> </div>
...@@ -58,10 +56,10 @@ ...@@ -58,10 +56,10 @@
</select> </select>
</td> </td>
<td> <td>
<span tal:replace="price"/> <span tal:replace="currency_code"/> <span tal:replace="python: order_line[0].getPrice() if len(order_line) == 1 else order_line[0].getPrice() + order_line[1].getTotalPrice() / order_line[0].getQuantity()"/> <span tal:replace="currency_code"/>
</td> </td>
<td> <td>
<span tal:replace="python: (price or 0)*(quantity or 0)"/> <span tal:replace="currency_code"/> <span tal:replace="python: sum([x.getTotalPrice() for x in order_line])"/> <span tal:replace="currency_code"/>
</td> </td>
</tr> </tr>
</tal:block> </tal:block>
...@@ -71,7 +69,8 @@ ...@@ -71,7 +69,8 @@
<table cellpadding="0" cellspacing="0"> <table cellpadding="0" cellspacing="0">
<tr> <tr>
<td><span tal:replace="python: here.Base_translateString('Tax')"/></td> <td><span tal:replace="python: here.Base_translateString('Tax')"/></td>
<tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()"> <td><span tal:replace="python: '%s %s' % (total_tax, currency_code)"/> </td>
<!--tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()">
<td> <span tal:replace="python: '%s %s' % (total_tax, currency_code)"/> </td> <td> <span tal:replace="python: '%s %s' % (total_tax, currency_code)"/> </td>
</tal:block> </tal:block>
<tal:block tal:condition="python: not here.ERP5Site_getAuthenticatedMemberPersonValue()"> <tal:block tal:condition="python: not here.ERP5Site_getAuthenticatedMemberPersonValue()">
...@@ -80,7 +79,7 @@ ...@@ -80,7 +79,7 @@
<span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/> <span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/>
</a> </a>
</td> </td>
</tal:block> </tal:block-->
</tr> </tr>
<tr> <tr>
<td><span tal:replace="python: here.Base_translateString('Sub Total')"/></td> <td><span tal:replace="python: here.Base_translateString('Sub Total')"/></td>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<table> <table>
<tal:block tal:define="dummy here/WebSection_updateShoppingCartAccordingToUserIfNeeded;" /> <tal:block tal:define="dummy here/WebSection_updateShoppingCartAccordingToUserIfNeeded;" />
<tal:block tal:define="shopping_cart here/SaleOrder_getShoppingCart; <tal:block tal:define="shopping_cart here/SaleOrder_getShoppingCart;
shopping_cart_item_list here/SaleOrder_getShoppingCartItemList; shopping_cart_item_list here/SaleOrder_getShoppingCartItemWithAdditionalServiceList;
web_site here/getWebSiteValue; web_site here/getWebSiteValue;
portal_path python:web_site.absolute_url(); portal_path python:web_site.absolute_url();
current_url request/URL; current_url request/URL;
...@@ -14,17 +14,15 @@ ...@@ -14,17 +14,15 @@
total_price python: here.SaleOrder_getShoppingCartTotalPrice(include_currency=True, discount=True);"> total_price python: here.SaleOrder_getShoppingCartTotalPrice(include_currency=True, discount=True);">
<tr tal:repeat="order_line shopping_cart_item_list"> <tr tal:repeat="order_line shopping_cart_item_list">
<td tal:define="resource python: web_site.restrictedTraverse(order_line.getResource()); <td tal:define="resource python: web_site.restrictedTraverse(order_line[0].getResource());
quantity python: int(order_line.getQuantity()); variation_dict python: order_line[0].DeliveryLine_getVarationDict();
price order_line/getPrice;
variation_dict python: order_line.DeliveryLine_getVarationDict();
variation python: variation_dict.pop('variation', None); variation python: variation_dict.pop('variation', None);
variation_title python: variation_dict.pop('variation_title', None); variation_title python: variation_dict.pop('variation_title', None);
option_title python: getattr(order_line, 'get%sTitle' % resource.getVariationBaseCategory().title())() if resource.getVariationBaseCategory() else ''" option_title python: getattr(order_line[0], 'get%sTitle' % resource.getVariationBaseCategory().title())() if resource.getVariationBaseCategory() else ''"
class="cart_top"> class="cart_top">
<div class="cart_left cart_item_name"> <div class="cart_left cart_item_name">
<span><span tal:replace="quantity"/> x </span> <span><span tal:replace="python: order_line[0].getQuantity()"/> x </span>
<a tal:condition="python: variation" class="articlelink" href="" tal:attributes="href python: '%s/%s?variation=%s' % (resource.absolute_url(), 'Resource_viewAsShop', variation);"> <a tal:condition="python: variation" class="articlelink" href="" tal:attributes="href python: '%s/%s?variation=%s' % (resource.absolute_url(), 'Resource_viewAsShop', variation);">
<span tal:content="resource/getTitle"/> <span tal:content="resource/getTitle"/>
</a> </a>
...@@ -34,10 +32,12 @@ ...@@ -34,10 +32,12 @@
<br tal:condition="variation_title | option_title"/> <br tal:condition="variation_title | option_title"/>
<span tal:content="variation_title" tal:condition="variation_title"/> <span tal:content="variation_title" tal:condition="variation_title"/>
<span tal:content="option_title" tal:condition="option_title"/> <span tal:content="option_title" tal:condition="option_title"/>
<span tal:content='python: "+ %s x %s" % (order_line[1].getQuantity() / order_line[0].getQuantity(), order_line[1].getResourceTitle())' tal:condition="python: len(order_line) == 2"/>
</div> </div>
<div class="cart_right"> <div class="cart_right">
<span> <span>
<span tal:replace="python: (price or 0)*(quantity or 0)"/> <span tal:replace="currency_symbol"/> <span tal:replace="python: sum([x.getTotalPrice() for x in order_line])"/> <span tal:replace="currency_symbol"/>
</span> </span>
</div> </div>
</td> </td>
...@@ -67,7 +67,10 @@ ...@@ -67,7 +67,10 @@
<div class="cart_left"> <div class="cart_left">
<span tal:replace="python: here.Base_translateString('Tax')"/> <span tal:replace="python: here.Base_translateString('Tax')"/>
</div> </div>
<tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()"> <div class="cart_right">
<span tal:replace="total_tax"/> <span tal:replace="currency_symbol"/>
</div>
<!--tal:block tal:condition="python: here.ERP5Site_getAuthenticatedMemberPersonValue()xxxx">
<div class="cart_right"> <div class="cart_right">
<span tal:replace="total_tax"/> <span tal:replace="currency_symbol"/> <span tal:replace="total_tax"/> <span tal:replace="currency_symbol"/>
</div> </div>
...@@ -78,7 +81,7 @@ ...@@ -78,7 +81,7 @@
<span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/> <span tal:replace="python: here.Base_translateString('Tax will be displayed after login')"/>
</a> </a>
</div> </div>
</tal:block> </tal:block-->
</td></tr> </td></tr>
</tal:block> </tal:block>
......
...@@ -21,7 +21,7 @@ if field_my_payment_mode is None: ...@@ -21,7 +21,7 @@ if field_my_payment_mode is None:
quantity = field_my_buy_quantity quantity = field_my_buy_quantity
shopping_cart = context.SaleOrder_getShoppingCart() shopping_cart = context.SaleOrder_getShoppingCart()
shopping_cart_product_item_list = context.SaleOrder_getShoppingCartItemList() shopping_cart_product_item_list = context.SaleOrder_getShoppingCartItemWithAdditionalServiceList()
# Handle change in quantity for shopping items # Handle change in quantity for shopping items
if quantity is not None: if quantity is not None:
...@@ -29,15 +29,17 @@ if quantity is not None: ...@@ -29,15 +29,17 @@ if quantity is not None:
# is a string rather as a list # is a string rather as a list
if isinstance(quantity, str): if isinstance(quantity, str):
quantity = [quantity] quantity = [quantity]
counter = 0 counter = 0
for order_line in shopping_cart_product_item_list: for order_line in shopping_cart_product_item_list:
new_quantity = int(quantity[counter]) new_quantity = int(quantity[counter])
if new_quantity>=1: if new_quantity>=1:
order_line.setQuantity(new_quantity) if len(order_line) == 2:
user_input = order_line[1].getQuantity() / order_line[0].getQuantity()
order_line[1].setQuantity(user_input * new_quantity)
order_line[0].setQuantity(new_quantity)
else: else:
# Remove it from shopping cart # Remove it from shopping cart
shopping_cart.manage_delObjects(order_line.getId()) shopping_cart.manage_delObjects([x.getId() for x in order_line])
counter += 1 counter += 1
# Handle shipping # Handle shipping
......
...@@ -8,4 +8,5 @@ if session_id is None: ...@@ -8,4 +8,5 @@ if session_id is None:
session_id = request.get('session_id', None) session_id = request.get('session_id', None)
request.RESPONSE.expireCookie('session_id') request.RESPONSE.expireCookie('session_id')
return context.portal_sessions.manage_delObjects(session_id) if session_id:
return context.portal_sessions.manage_delObjects(session_id)
...@@ -52,6 +52,14 @@ ...@@ -52,6 +52,14 @@
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>session_id=None</string> </value> <value> <string>session_id=None</string> </value>
</item> </item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>WebSection_resetShoppingCart</string> </value> <value> <string>WebSection_resetShoppingCart</string> </value>
......
return
if not context.ERP5Site_getAuthenticatedMemberPersonValue(): if not context.ERP5Site_getAuthenticatedMemberPersonValue():
return return
......
""" """
Update Trade Condition with the appropriated Trade Condition. Update Trade Condition with the appropriated Trade Condition.
""" """
shopping_cart.setSpecialise(context.WebSection_getDefaultTradeCondition())
portal = context.getPortalObject()
portal.portal_sessions[container.REQUEST['session_id']].update(shopping_cart=shopping_cart)
return
portal = context.getPortalObject() portal = context.getPortalObject()
if payment_mode is None and preserve: if payment_mode is None and preserve:
current_trade_condition = shopping_cart.getSpecialiseValue() current_trade_condition = shopping_cart.getSpecialiseValue()
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
subsection_list python:current_web_site.getSubsectionList(); subsection_list python:current_web_site.getSubsectionList();
is_root python:current_web_site is current_web_section; is_root python:current_web_site is current_web_section;
"> ">
<tal:block tal:condition="python: len(subsection_list) != 0">
<tal:block tal:define="menu_item_list_list python: [context.restrictedTraverse(subsection_list[0]).WebSection_getSiteMapTree(depth=1)] if is_root else [current_main_section.WebSection_getSiteMapTree(depth=1) for x in subsection_list if current_main_section.getRelativeUrl() == x]"> <tal:block tal:define="menu_item_list_list python: [context.restrictedTraverse(subsection_list[0]).WebSection_getSiteMapTree(depth=1)] if is_root else [current_main_section.WebSection_getSiteMapTree(depth=1) for x in subsection_list if current_main_section.getRelativeUrl() == x]">
<ul tal:repeat="menu_item_list menu_item_list_list"> <ul tal:repeat="menu_item_list menu_item_list_list">
<li tal:repeat="menu_item menu_item_list"> <li tal:repeat="menu_item menu_item_list">
<a href="" tal:attributes="href menu_item/url" <a href="" tal:attributes="href menu_item/url"
tal:content="menu_item/translated_title"></a> tal:content="menu_item/translated_title"></a>
</li> </li>
</ul> </ul>
</tal:block> </tal:block>
</tal:block>
</tal:block> </tal:block>
\ No newline at end of file
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<string>your_reference</string> <string>your_reference</string>
<string>your_password</string> <string>your_password</string>
<string>your_password_confirm</string> <string>your_password_confirm</string>
<string>your_password_policy</string>
<string>your_came_from</string> <string>your_came_from</string>
<string>your_is_loyalty_section</string> <string>your_is_loyalty_section</string>
<string>your_is_shopping_cart</string> <string>your_is_shopping_cart</string>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>css_class</string> </key> <key> <string>css_class</string> </key>
<value> <string>hidden</string> </value> <value> <string>hidden_label</string> </value>
</item> </item>
<item> <item>
<key> <string>default</string> </key> <key> <string>default</string> </key>
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Vat Code(only if you\\\'re an organisation)</string> </value> <value> <string>Vat Code(only if you\'re an organisation)</string> </value>
</item> </item>
</dictionary> </dictionary>
</value> </value>
......
...@@ -54,9 +54,7 @@ ...@@ -54,9 +54,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <value> <string></string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -79,7 +77,7 @@ ...@@ -79,7 +77,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>enabled</string> </key> <key> <string>enabled</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
...@@ -99,17 +97,4 @@ ...@@ -99,17 +97,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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: not here.portal_membership.isAnonymousUser() and here.getSiteLoyaltyExplanationTemplate()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
...@@ -93,18 +93,18 @@ ...@@ -93,18 +93,18 @@
</fieldset> </fieldset>
</div> </div>
<tal:block tal:replace="structure here/WebSection_viewLoyaltyReward"> Loyalty Reward </tal:block> <!--tal:block tal:replace="structure here/WebSection_viewLoyaltyReward"> Loyalty Reward </tal:block-->
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<tal:block tal:condition="python: here.getSiteMessageTemplate()"> <!--tal:block tal:condition="python: here.getSiteMessageTemplate()">
<div class="site_warning_message" id="site_warning_message" <div class="site_warning_message" id="site_warning_message"
tal:define="message python:here.getDocumentValue(here.getSiteMessageTemplate()).asStrippedHTML()" tal:define="message python:here.getDocumentValue(here.getSiteMessageTemplate()).asStrippedHTML()"
tal:content="structure message"> tal:content="structure message">
</div> </div>
</tal:block> </tal:block-->
<div class="clear"></div> <div class="clear"></div>
......
...@@ -1318,4 +1318,8 @@ pre.product-description{ ...@@ -1318,4 +1318,8 @@ pre.product-description{
.product-description a{ .product-description a{
text-decoration:underline; text-decoration:underline;
color:#1c1cd8; color:#1c1cd8;
}
.hidden_came_from{
display:none;
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Image" module="OFS.Image"/> <global name="File" module="OFS.Image"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</item> </item>
<item> <item>
<key> <string>content_type</string> </key> <key> <string>content_type</string> </key>
<value> <string>image/vnd.microsoft.icon</string> </value> <value> <string>image/png</string> </value>
</item> </item>
<item> <item>
<key> <string>precondition</string> </key> <key> <string>precondition</string> </key>
......
...@@ -59,7 +59,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -59,7 +59,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
</tal:block> </tal:block>
</div> </div>
<tal:block tal:define="has_supply_discount python: here.getDefaultSaleSupplyLineBasePrice() > here.Resource_getShopPrice()"> <span class="bprice">
<tal:block tal:define="field nocall:form/my_price">
<tal:block metal:use-macro="field_render" />
</tal:block>
</span>
<!--tal:block tal:define="has_supply_discount python: here.getDefaultSaleSupplyLineBasePrice() > here.Resource_getShopPrice()">
<tal:block tal:condition="has_supply_discount"> <tal:block tal:condition="has_supply_discount">
<span class="bnprice"> <span class="bnprice">
<tal:block tal:define="field nocall:form/my_price"> <tal:block tal:define="field nocall:form/my_price">
...@@ -81,7 +86,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -81,7 +86,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
</span> </span>
</tal:block> </tal:block>
</tal:block> </tal:block-->
<div class="clear"></div> <div class="clear"></div>
<div class="choice_box"> <div class="choice_box">
...@@ -92,29 +97,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -92,29 +97,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<div class="clear"></div> <div class="clear"></div>
<br/> <br/>
<!--tal:block tal:define="is_unavailable python: here.Resource_getInventoryStatus(request.get('variation', None)) == 'UNAVAILABLE'"--> <!--tal:block tal:define="is_unavailable python: here.Resource_getInventoryStatus(request.get('variation', None)) == 'UNAVAILABLE'"-->
<tal:block tal:define="is_unavailable python: False">
<tal:block tal:define="field nocall:form/your_buy_quantity" <tal:block tal:define="field nocall:form/your_additional_service">
tal:condition="python: not is_unavailable"> <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" />
</tal:block>
<tal:block tal:define="field nocall:form/inventory_status">
<tal:block metal:use-macro="field_render" />
</tal:block>
<div class="clear"></div>
<div class="resource_button">
<tal:block tal:define="field nocall:form/submit">
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
</tal:block> </tal:block>
<tal:block tal:define="field nocall:form/checkout">
<tal:block tal:define="field nocall:form/inventory_status">
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
</tal:block> </tal:block>
</div>
<div class="clear"></div>
<div class="resource_button">
<tal:block tal:define="field nocall:form/submit"
tal:condition="python: not is_unavailable">
<tal:block metal:use-macro="field_render" />
</tal:block>
<tal:block tal:define="field nocall:form/checkout"
tal:condition="python: not is_unavailable">
<tal:block metal:use-macro="field_render" />
</tal:block>
</div>
</tal:block>
<div class="clear"></div> <div class="clear"></div>
<tal:block tal:define="field nocall:form/social_box"> <tal:block tal:define="field nocall:form/social_box">
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
...@@ -139,6 +146,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -139,6 +146,36 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
</tal:block> </tal:block>
</div> </div>
<tal:block tal:condition='python: here.Localizer.get_selected_language() != "zh"'>
<div class="tab_content" id="tabs-2"
tal:content="structure python:here.web_page_module['10592'].asStrippedHTML()">
Livraison
</div>
<div class="tab_content" id="tabs-3"
tal:content="structure python:here.web_page_module['10594'].asStrippedHTML()">
Retour
</div>
<div class="tab_content" id="tabs-4"
tal:content="structure python:here.web_page_module['10593'].asStrippedHTML()">
Paiement
</div>
</tal:block>
<tal:block tal:condition='python: here.Localizer.get_selected_language() == "zh"'>
<div class="tab_content" id="tabs-2"
tal:content="structure python:here.web_page_module['10669'].asStrippedHTML()">
Livraison
</div>
<div class="tab_content" id="tabs-3"
tal:content="structure python:here.web_page_module['10670'].asStrippedHTML()">
Retour
</div>
<div class="tab_content" id="tabs-4"
tal:content="structure python:here.web_page_module['10671'].asStrippedHTML()">
Paiement
</div>
</tal:block>
<!--
<tal:block tal:condition="python: here.getSiteDeliveryMessageTemplate()"> <tal:block tal:condition="python: here.getSiteDeliveryMessageTemplate()">
<div class="tab_content" id="tabs-2" <div class="tab_content" id="tabs-2"
tal:content="structure python:here.getDocumentValue(here.getSiteDeliveryMessageTemplate()).asStrippedHTML()"> tal:content="structure python:here.getDocumentValue(here.getSiteDeliveryMessageTemplate()).asStrippedHTML()">
...@@ -157,6 +194,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ...@@ -157,6 +194,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Paiement Paiement
</div> </div>
</tal:block> </tal:block>
-->
<script> <script>
$(function() { $(function() {
$("#tabs ul a").each(function() { $("#tabs ul a").each(function() {
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>my_additional_service_title</string>
<string>my_additional_service_min_quantity</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleSupplyLine_viewAdditionalService</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleSupplyLine_viewAdditionalService</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Additional Service</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Person | web_view Person | web_view
Product | web_view Product | web_view
\ No newline at end of file Sale Supply Line | additional_service
\ No newline at end of file
additional_service
\ No newline at end of file
Sale Supply Line | additional_service
Web Site | specialise Web Site | specialise
\ 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