Skip to main content
added 11 characters in body
Source Link
jimiyash
  • 2.5k
  • 2
  • 20
  • 29

The way I usually handle problems like this is by indexing the $list by the Product ID using the Set class, which is built into Cake. So

$list = Set::combine($list, '{n}.Product.id', '{n}.Product');

Then use loop through your cart ($products) which is already in the order you want

foreach($products as $prod) echo $list[$prod]['Product']['name'];

Hope this helps.

The way I usually handle problems like this is by indexing the $list by the Product ID using Set which is built into Cake. So

$list = Set::combine($list, '{n}.Product.id', '{n}.Product');

Then use loop through your cart ($products) which is already in the order you want

foreach($products as $prod) echo $list[$prod]['Product']['name'];

Hope this helps.

The way I usually handle problems like this is by indexing the $list by the Product ID using the Set class, which is built into Cake. So

$list = Set::combine($list, '{n}.Product.id', '{n}.Product');

Then use loop through your cart ($products) which is already in the order you want

foreach($products as $prod) echo $list[$prod]['Product']['name'];

Hope this helps.

Source Link
jimiyash
  • 2.5k
  • 2
  • 20
  • 29

The way I usually handle problems like this is by indexing the $list by the Product ID using Set which is built into Cake. So

$list = Set::combine($list, '{n}.Product.id', '{n}.Product');

Then use loop through your cart ($products) which is already in the order you want

foreach($products as $prod) echo $list[$prod]['Product']['name'];

Hope this helps.