Hi everybody,
GC saved me a lot of time, I love it a lot.
Now I have a problem with callback_before_update and the amazon api. I searched a lot via google and in this forum, but I didn't find any solutions.
I have in my database table two rows with amazon values: price_new and price_old. I want to receive this values via the amazon api.
For this I have created a function:
public function getAmazonInformation($post_array,$primary_key) { $amazonerg = $this->amazon_api->getItemByEan($post_array['ean_code']); $price_new = $amazonerg->Items->Item->OfferSummary->LowestNewPrice->FormattedPrice; $price_used = $amazonerg->Items->Item->OfferSummary->LowestUsedPrice->FormattedPrice; $post_array["price_amazon_new"] = $price_new; $post_array["price_amazon_used"] = $price_used; return $post_array; }
My CRUD Function looks like:
public function item() { $crud = new grocery_CRUD(); $crud->set_theme('datatables'); $crud->set_table('item'); $crud->set_subject('Item'); $crud->columns('main_media','model','price','filter','power_watt','noise_level'); $crud->set_relation('manufacturer_id','manufacturer','name'); $crud->set_field_upload('main_media','assets/uploads/'); $crud->callback_before_update(array($this, 'getAmazonInformation')); $crud->callback_after_upload(array($this,'thumbnailer')); $crud->unset_texteditor('teaser'); $crud->unset_read(); $output = $crud->render(); $this->_example_output($output); }
It doesn't works and I dont know why. When I call the function getAmazonInformation direct, everything works fine. The values are right, but via the callback function nothing happens and the values aren't available.
Thank you for your support!