Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Hooks in admin and collecting data saved Rate Topic   - - - - -

 
  • hostandname
  • Senior Member
  • Members
  • Join Date: 05-Jan 06
  • 196 posts

Posted 14 September 2012 - 08:42 AM #1

Hi guys, im a little stuck with something - i have an input in admin when editing a product - i enter a value and save it (it saves to database) however i want to show the saved value in the input of the product im editing but cannot work it out

ive tried product_data.blah but no go

ive also tried with hooks

$view->assign('product_data', $product_data);

etc... with no luck, anyone have any ideas?

Thanks

Host & Name Ltd - your reliable & trustworthy media provider (www.hostandname.co.uk)
Approved CS-Cart Developers and Official CS-Cart Licensing Supplier
Web Hosting | Cloud Hosting | Dedicated Servers | VPS | Domains | Emails | Design | Development | Marketing | Management


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11429 posts

Posted 15 September 2012 - 05:10 AM #2

if your new field is not pulled with the standard fn_get_product() then you will need to use a 'addons/my_changes/controllers/admin/products.post.php' controller.
You would extract the current product data via:
if( $_SERVER['REQUEST_METHOD'] != 'POST' ) {
    $product_data = Registry::get('view')->get_var('product_data');
    // $product_data['new_field'] = db_get_field("SELECT new_field FROM ?:products WHERE product_id=?i", $_REQUEST['product_id']);
    // Then write it back to it's visible to the template
    Registry::get('view')->assign('product_data', $product_data);
}
retrun array(CONTROLLER_STATUS_OK);

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.