Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
erp5
Commits
98e72868
Commit
98e72868
authored
Aug 06, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_advanced_ecommerce: fix price issue and display always variation lower price
parent
6066f6f0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Resource_getWebShopImageURL.py
...ns/erp5_advanced_ecommerce/Resource_getWebShopImageURL.py
+13
-5
No files found.
bt5/erp5_advanced_ecommerce/SkinTemplateItem/portal_skins/erp5_advanced_ecommerce/Resource_getWebShopImageURL.py
View file @
98e72868
...
...
@@ -16,18 +16,26 @@ else:
default_image
=
context
.
getDefaultImageValue
()
if
default_image
is
not
None
:
# if current product has image, consider that it has no variation
return
default_image
.
absolute_url
()
#xxxx if current product has image, consider that it has no variation
if
len
([
x
for
x
in
context
.
contentValues
(
portal_type
=
'Product Individual Variation'
)
if
x
.
getVisibilityState
()
==
"visible"
])
==
0
:
return
default_image
.
absolute_url
()
def
getAvailableVariation
(
individual_variation_list
):
price
=
None
default
=
context
.
REQUEST
.
get
(
'variation'
,
None
)
for
individual_variation
in
individual_variation_list
:
return
individual_variation
context
.
REQUEST
.
set
(
"variation"
,
individual_variation
.
getRelativeUrl
())
tmp
=
context
.
Resource_getShopPrice
()
if
price
==
None
or
price
>
tmp
:
price
=
tmp
min_individual_variation
=
individual_variation
context
.
REQUEST
.
set
(
"variation"
,
default
)
return
min_individual_variation
#if context.Resource_getInventoryStatus(variation=individual_variation.getRelativeUrl()) in ("STOCK", "AVAILABLE"):
# return individual_variation
return
None
individual_variation_list
=
[
x
for
x
in
context
.
contentValues
(
portal_type
=
'Product Individual Variation'
)
if
x
.
getVisibilityState
()
==
"visible"
]
random
.
shuffle
(
individual_variation_list
)
individual_variation
=
getAvailableVariation
(
individual_variation_list
)
if
individual_variation
:
if
image_id
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment