Commit d5351fa9 authored by Jean-Paul Smets's avatar Jean-Paul Smets Committed by Xiaowu Zhang

Added checkout section

Also improved comments and docstring including TODO.
parent 4b6572d6
......@@ -50,28 +50,48 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>translateString = context.Base_translateString \n
<value> <string encoding="cdata"><![CDATA[
"""\n
This script initializes an ecommerce web site by creating relevant\n
web sections.\n
\n
It is a destructive script. Make sure you never run it on an \n
existing site.\n
\n
TODO:\n
- add security definitions and workflows (or in bt5)\n
- product module security & commerce workflow\n
- service module security & commerce workflow\n
- currency module security & commerce workflow\n
- anonymous access to person module\n
- anonymous access to Sale Order Module\n
- anonymous access to sale_trade_condition_module\n
"""\n
translateString = context.Base_translateString \n
\n
if (context.getPortalType() != \'Web Site\'):\n
context.Base_redirect(\'\', keep_items={\n
\'portal_status_message\': translateString("You can only launch this script on a web site.", mapping = dict())\n
})\n
\n
# creation the default sections\n
object_id_list = [\'cart\', \'account\', \'register\']\n
# Create default sections (cart, account, register, checkout)\n
# First delete whatever exists\n
object_id_list = [\'cart\', \'account\', \'register\', \'checkout\']\n
for id in object_id_list:\n
if id in context.objectIds():\n
context.manage_delObjects([id])\n
\n
# Then recreate sections with default title\n
cart_section = context.newContent(portal_type=\'Web Section\', title=\'Cart\', id=\'cart\')\n
account_section = context.newContent(portal_type=\'Web Section\', title=\'My account\', id=\'account\')\n
register_section = context.newContent(portal_type=\'Web Section\', title=\'Register\', id=\'register\')\n
checkout_section = context.newContent(portal_type=\'Web Section\', title=\'Checkout\', id=\'checkout\')\n
\n
# make some visible by default\n
# Some sections should be visible by default\n
cart_section.setVisible(True)\n
\n
# setup site properties\n
# Setup site properties to default values\n
context.setContainerLayout(\'erp5_web_multiflex5_commerce_layout\')\n
context.setLayoutConfigurationFormId(\'WebSection_viewMultiflex5Configuration\')\n
context.setProperty(\'layout_right_column\', True)\n
......@@ -79,16 +99,22 @@ context.setSiteMapSectionParent(True)\n
context.setContentLayout(None)\n
context.setProperty(\'layout_additional_css\', \'mf54_commerce.css\')\n
\n
# setup default render method\n
# Setup default render method for cart section\n
cart_section.setCustomRenderMethodId(\'SaleOrder_viewAsWeb\')\n
cart_section.setProperty(\'ecommerce_default_content\', True)\n
cart_section.setProperty(\'ecommerce_product_list\', False)\n
\n
# Setup default render method for account section\n
account_section.setCustomRenderMethodId(\'WebSection_viewCurrentPersonAsWeb\')\n
account_section.setProperty(\'ecommerce_default_content\', True)\n
account_section.setProperty(\'ecommerce_product_list\', False)\n
\n
# Setup default render method for registration section\n
register_section.setCustomRenderMethodId(\'WebSite_viewRegistrationDialog\')\n
register_section.setProperty(\'ecommerce_default_content\', True)\n
register_section.setProperty(\'ecommerce_product_list\', False)\n
\n
# Setup default render method for checkout section\n
checkout_section.setCustomRenderMethodId(\'SaleOrder_viewConfirmAsWeb\')\n
checkout_section.setProperty(\'ecommerce_default_content\', True)\n
checkout_section.setProperty(\'ecommerce_product_list\', False)\n
......@@ -96,7 +122,9 @@ checkout_section.setProperty(\'ecommerce_product_list\', False)\n
context.Base_redirect(\'\', keep_items={\n
\'portal_status_message\': translateString("Your web site is now an ecommerce plateform.", mapping = dict())\n
})\n
</string> </value>
]]></string> </value>
</item>
<item>
<key> <string>_params</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