Changeset 422

Show
Ignore:
Timestamp:
02/03/08 18:34:08 (3 months ago)
Author:
yurin
Message:

Fixed product images actions.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 2.0/trunk/app/controllers/product_images_controller.php

    r421 r422  
    7474                        if ($this->ProductImage->save($this->data)) { 
    7575                                $this->Session->setFlash(__('The ProductImage has been saved', true)); 
    76                                 $this->redirect(array('action'=>'index')); 
     76                                $this->redirect(array('controller' => 'products', 'action'=>'view', $this->data['ProductImage']['product_id'])); 
    7777                        } else { 
    7878                                $this->Session->setFlash(__('The ProductImage could not be saved. Please, try again.', true)); 
     
    8484                $products = $this->ProductImage->Product->find('list'); 
    8585                $this->set(compact('products')); 
     86                 
     87                $product = $this->ProductImage->Product->read(null, $this->data['ProductImage']['product_id']); 
     88                $this->set('product', $product['Product']); 
     89                 
    8690        } 
    8791 
     
    9195                        $this->redirect(array('action'=>'index')); 
    9296                } 
     97                if (empty($this->data)) { 
     98                        $this->data = $this->ProductImage->read(null, $id); 
     99                } 
     100                 
    93101                if ($this->ProductImage->del($id)) { 
    94102                        $this->Session->setFlash(__('ProductImage deleted', true)); 
    95                         $this->redirect(array('action'=>'index')); 
     103                        $this->redirect(array('controller' => 'products', 'action'=>'view', $this->data['ProductImage']['product_id'])); 
    96104                } 
    97105        } 
  • 2.0/trunk/app/views/product_images/admin_edit.ctp

    r409 r422  
    2828<?php echo $form->create('ProductImage');?> 
    2929        <fieldset> 
    30                 <legend><?php __('Edit ProductImage');?></legend> 
     30                <legend><?php __('Edit ProductImage for: ' . $product['name']);?></legend> 
    3131        <?php 
    3232                echo $form->input('id'); 
    33                 echo $form->input('product_id'); 
     33                echo $form->input('product_id', array('type' => 'hidden', 'value' => $product['id'])); 
     34                //echo $form->input('product_id'); 
    3435                echo $form->input('image'); 
    3536                echo $form->input('priority');