Thank u for giving solution
On Thu, Jul 11, 2013 at 4:00 AM, lowpass <zijn.digital@gmail.com> wrote:
CREATE TABLE product_attributes (`product_id` BINARY(36) NOT NULL,`field` VARCHAR(255) NOT NULL,`value` VARCHAR(255) DEFAULT NULL,UNIQUE (`product_id`, `field`),CONSTRAINT `FK_product_attributes_items`FOREIGN KEY (`product_id`)REFERENCES `products` (`id`)ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;class Product extends AppModel {public $hasMany = array('ProductAttribute');// ...}class ProductAttribute extends AppModel {public $belongsTo = array('Product');function beforeSave($options = array()) {foreach($this->data[$this->alias] as $field => $value) {if (!in_array($field, array('product_id', 'field', 'value'))) {$this->data[$this->alias]['field'] = $field;$this->data[$this->alias]['value'] = $value;}}return true;}}<fieldset id=""><legend>Attributes</legend><?= $this->Form->input('ProductAttribute.0.field', array('label' => 'name')) ?><?= $this->Form->input('ProductAttribute.0.value', array('label' => 'value')) ?></fieldset>Use javascript to add new form elements as needed.--On Wed, Jul 10, 2013 at 2:34 AM, raj kumar Pustela <pustelaraj@gmail.com> wrote:
My requirement:
I have a one table : products
these are fields:
id
product_name
sku
enough
Then i need add another field from ui
Product->add->
input ---name
text--->value
name -- size
value-- m
it's add directly in product tables.. after completed
then u can see in product tabls
id
product_name
sku
size
if any one known pls help me.Thanks,Rajakumar--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment