Commit d61398d1 authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Xiaowu Zhang

Fix Script Name to follow Conventions

It includes minor improvements.
parent 5483f491
......@@ -200,7 +200,7 @@
request = context.REQUEST\n
translateString = context.Base_translateString \n
if field_my_buy_quantity is None:\n
field_my_buy_quantity=context.REQUEST.get("field_my_buy_quantity", None)\n
field_my_buy_quantity = context.REQUEST.get("field_my_buy_quantity", None)\n
\n
if field_my_shipping_method is None:\n
field_my_shipping_method=context.REQUEST.get("field_my_shipping_method", None) \n
......@@ -209,11 +209,9 @@ if field_my_payment_mode is None:\n
field_my_payment_mode = context.REQUEST.get("field_my_payment_mode", None) \n
\n
quantity = field_my_buy_quantity\n
shipping_method = field_my_shipping_method\n
shopping_cart_items = context.SaleOrder_getShoppingCartItemList(include_shipping=True)\n
shopping_cart_products_items = filter(lambda x: x.getId()!=\'shipping_method\', shopping_cart_items)\n
shopping_cart = context.SaleOrder_getShoppingCart()\n
\n
shopping_cart = context.SaleOrder_getShoppingCart()\n
shopping_cart_product_item_list = context.SaleOrder_getShoppingCartItemList()\n
\n
# Handle change in quantity for shopping items\n
if quantity is not None:\n
......@@ -223,7 +221,7 @@ if quantity is not None:\n
quantity = [quantity]\n
\n
counter = 0\n
for order_line in shopping_cart_products_items:\n
for order_line in shopping_cart_product_item_list:\n
new_quantity = int(quantity[counter])\n
if new_quantity>=1:\n
order_line.setQuantity(new_quantity)\n
......@@ -233,23 +231,24 @@ if quantity is not None:\n
counter += 1\n
\n
# Handle shipping\n
order_line = getattr(shopping_cart, \'shipping_method\', None)\n
if shipping_method not in [\'\', None]:\n
shipping = context.getPortalObject().restrictedTraverse(shipping_method)\n
if order_line is not None:\n
shopping_cart.manage_delObjects(order_line.getId())\n
if field_my_shipping_method not in [\'\', None]:\n
line = getattr(shopping_cart, \'shipping_method\', None)\n
if line is not None:\n
shopping_cart.manage_delObjects(line.getId())\n
shipping = context.getPortalObject().restrictedTraverse(field_my_shipping_method)\n
# create new shipping method order line\n
order_line = shopping_cart.newContent(id=\'shipping_method\', portal_type=\'Sale Order Line\')\n
# .. and update it\n
order_line.setResource(shipping.getRelativeUrl())\n
order_line.setQuantity(1)\n
shopping_cart.newContent(\n
id=\'shipping_method\', \n
portal_type=\'Sale Order Line\', \n
resource_value=shipping, \n
quantity=1)\n
\n
# Handle payment mode and comment\n
if field_my_comment is not None:\n
shopping_cart.setComment(field_my_comment)\n
\n
if field_my_payment_mode is not None:\n
shopping_cart.setPaymentConditionPaymentMode(field_my_payment_mode) # XXX This is bad because it does not use trade conditions XXX\n
shopping_cart.setPaymentConditionPaymentMode(field_my_payment_mode)\n
\n
if redirect:\n
# Hardcode redirection.\n
......@@ -274,7 +273,7 @@ if redirect:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value>
<value> <string>WebSection_editShoppingCart</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -61,7 +61,7 @@ isAnon = context.portal_membership.isAnonymousUser()\n
translateString = context.Base_translateString\n
\n
# Make sure we save shopping cart informations modified on last minute.\n
context.SaleOrder_editShoppingCart(redirect=False, **kw)\n
context.WebSection_editShoppingCart(redirect=False, **kw)\n
\n
shopping_cart = context.SaleOrder_getShoppingCart()\n
field_my_comment = shopping_cart.getComment()\n
......@@ -73,7 +73,7 @@ if isAnon:\n
msg = translateString("You need to login or create an account to continue.")\n
from ZTUtils import make_query\n
parameter_string = make_query(field_my_comment=field_my_comment, field_my_payment_mode=field_my_payment_mode)\n
coming_from_url = \'%s/SaleOrder_paymentRedirect?%s\' % (context.absolute_url(), parameter_string)\n
coming_from_url = \'%s/WebSection_paymentRedirect?%s\' % (context.absolute_url(), parameter_string)\n
return web_site.Base_redirect(\'login_form\', \\\n
keep_items={\'portal_status_message\': msg,\n
\'came_from\': coming_from_url})\n
......@@ -107,7 +107,7 @@ context.Base_redirect(\'WebSection_viewShoppingCart\', \\\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SaleOrder_paymentRedirect</string> </value>
<value> <string>WebSection_paymentRedirect</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -35,7 +35,7 @@
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SaleOrder_editShoppingCart</string> </value>
<value> <string>WebSection_editShoppingCart</string> </value>
</item>
<item>
<key> <string>description</string> </key>
......@@ -139,7 +139,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>Product_view</string> </value>
<value> <string>WebSection_viewShoppingCart</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
......
......@@ -134,26 +134,20 @@
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.getWebSiteValue().SaleOrder_getShoppingCart().getPaymentConditionPaymentMode()</string> </value>
<value> <string>python: here.SaleOrder_getShoppingCart().getPaymentConditionPaymentMode()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
......@@ -166,10 +160,7 @@
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
<tuple/>
</tuple>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -164,7 +164,7 @@
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SaleOrder_paymentRedirect:method</string> </value>
<value> <string>WebSection_paymentRedirect:method</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
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