Jump to content

blockviewed - not to repeat the value of (a category or brand) in the array.


Nikpro

Recommended Posts

Hi
I would like to create a delicious proposal to humans.
 
I'm half way.
I only left out showed no repeat value.
 
At the moment, I have shown on the basis of a product review.
1. Categories
2. Manufacturers
 
But now they are repeated
 
I added line 266
 
 
$ Obj-> id_manufacturer = (int) ($ productsImagesArray [$ productViewed] [ 'id_manufacturer']);
 
$ Obj-> id_category_default = (int) ($ productsImagesArray [$ productViewed] [ 'id_category_default']);
 

 

 

 

and appeal to the base

SELECT MAX(image_shop.id_image) id_image, p.id_product, il.legend, product_shop.active, pl.name,

 p.id_manufacturer,
p.id_category_default,
 
 
m.name AS manufacturer_name,

 

 
 
 
 
in  tpl 
 
{$link->getCategoryLink($viewedProduct->id_category_default)}

 

 

 
 
How can I eliminate the repetition of values?
post-91213-0-20563900-1467268804_thumb.jpg
 
  1. $c=array();
  2. foreach($a as $b)
  3. {
  4.     if(!in_array($b,$c))
  5.     {
  6.      $c[]=$b;
  7.      echo $b;
  8.     }
  9. }
  10.  
I know that there is a way to compare. but after spending 2 days I was not able to find a solution (((
 
 
 
if (is_array($obj->id_manufacturer) && count($obj->id_manufacturer))
{
foreach ($obj->id_manufacturer as $key => $obj->id_manufacturer)
{
if ($productsImagesArray[$productViewed]['id_manufacturer'] == $obj->id_manufacturer)
{
unset($obj->id_manufacturers[$key]);
 
}
}
} ;
 
 
 
 

 

 

Edited by Nikpro (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...