Skip to content

Commit

Permalink
[-] WS : Fix bad xlink in combination association image
Browse files Browse the repository at this point in the history
[-] WS : Fix duplicate id in images/products entity
  • Loading branch information
anat committed Sep 2, 2014
1 parent a90fc68 commit cdcb7ef
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion classes/Combination.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class CombinationCore extends ObjectModel
),
'associations' => array(
'product_option_values' => array('resource' => 'product_option_value'),
'images' => array('resource' => 'image'),
'images' => array('resource' => 'image', 'api' => 'images/products'),
),
);

Expand Down
11 changes: 10 additions & 1 deletion classes/webservice/WebserviceOutputBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,18 @@ protected function renderFlatAssociation($object, $depth, $assoc_name, $resource
if (isset($this->wsResource[$assoc_name]) && is_null($this->schemaToDisplay))
{
if ($assoc_name == 'images')
$more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/'.$parent_details['entities_name'].'/'.$parent_details['object_id'].'/'.$object_assoc['id'];
{
if ($parent_details['entities_name'] == 'combinations')
{
$more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/products/'.$object->id_product.'/'.$object_assoc['id'];
}
else
$more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/'.$parent_details['entities_name'].'/'.$parent_details['object_id'].'/'.$object_assoc['id'];
}
else
{
$more_attr['xlink_resource'] = $this->wsUrl.$assoc_name.'/'.$object_assoc['id'];
}
}
$output .= $this->setIndent($depth-1).$this->objectRender->renderNodeHeader($resource_name, array(), $more_attr);

Expand Down
4 changes: 2 additions & 2 deletions classes/webservice/WebserviceSpecificManagementImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,8 @@ protected function manageEntityDeclinatedImages($directory, $normal_image_sizes)
foreach ($languages as $language)
foreach (Image::getImages($language['id_lang'], $object_id) as $image)
$available_image_ids[] = $image['id_image'];


$available_image_ids = array_unique($available_image_ids, SORT_NUMERIC);
// If an image id is specified
if ($this->wsObject->urlSegment[3] != '')
{
Expand Down

0 comments on commit cdcb7ef

Please sign in to comment.