basic php
you cannot override $discount_price locally and expect it to change
anything outside of the loop and the scope of this change

if(!isset($discount_price)) $discount_prices[$key] =
$item_prices[$key];


On 20 Dez., 16:37, roundrightfarm <roundrightf...@gmail.com> wrote:
> The two arrays made with find() look like I would expect them to, but
> the foreach loop leaves $discount_prices (of which many have null
> values) unaffected.  What am I missing here?
>
> //get regular prices
>                 $item_prices = $this->Item->find('list', array('fields' =>
> array('Item.price')));
>
> //see if there are any discounts prices for the week's items
>                 $discount_prices = $this->Order->Week->WeeksItem->find('list',
>
> array('fields'=>array('item_id','discount_price'),
> 'conditions'=>array('week_id'=>$week_id)));
>
> //if there is no discount price (value is null), add the regular price
>                 foreach($discount_prices as $key => $discount_price){
>                         if(!isset($discount_price)) $discount_price = 
> $item_prices[$key];
>                 }

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to