Commit 1cf42597 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_advanced_ecommerce: use web page to descript product

parent 912982da
<p tal:content="here/getDescription">
</p>
<tal:block tal:define="web_page_description python: here.Product_getRelatedDescription()">
<pre tal:condition="python: not web_page_description" class="product-description" tal:content="structure python: here.getDescription()">
</pre>
<div class="product-description" tal:content="structure python: web_page_description"></div>
</tal:block>
<div class="product-detail">
<p tal:condition="here/getBaseWidth">
<b i18n:translate="" i18n:domain="ui">Width:</b> <span tal:replace="python: here.getBaseWidth() * 100"/> cm
......
from Products.ERP5Type.Cache import CachingMethod
portal = context.getPortalObject()
def getProductRelatedDescription():
web_page = portal.portal_catalog(portal_type='Web Page',
default_follow_up_uid=context.getUid(),
language=portal.Localizer.get_selected_language(),
limit=1
)
if web_page:
return web_page[0].asStrippedHTML()
return ""
getProductRelatedDescription = CachingMethod(getProductRelatedDescription,
("Product_getRelatedDescription-%s-%s" % (context.getUid(), portal.Localizer.get_selected_language()),),
cache_factory='erp5_ui_long')
return getProductRelatedDescription()
<?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>id</string> </key>
<value> <string>Product_getRelatedDescription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1291,3 +1291,18 @@ ul.Individual_variation {
ul li:not(:first-child) ul li {
padding-left: 10px;
}
pre.product-description{
overflow-x: auto;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
.product-description a{
text-decoration:underline;
color:#1c1cd8;
}
\ 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