Skip to content

Instantly share code, notes, and snippets.

@pnomolos
Created January 5, 2012 17:26
Show Gist options
  • Save pnomolos/1566247 to your computer and use it in GitHub Desktop.
Save pnomolos/1566247 to your computer and use it in GitHub Desktop.
Lemonstand - Minimize memory when using products
<?php
$grouped_product = new Shop_Product(null, array('no_validation' => true, 'no_column_init' => true, 'no_timestamps' => true));
$data = $_POST['Shop_Product'];
$data['grouped'] = 1;
$data['name'] = $product->name . ' ('.$attributes->name.')';
$data['url_name'] .= '_'.uniqid('', true);
$data['sku'] .= '-' . strtolower($attributes->sku.uniqid('', true));
$data['grouped_option_desc'] = $attributes->name;
$data['x_aga_ids'] = join(':', $ids);
$data['product_id'] = $product->id;
$grouped_product->save($data, $controller->formGetEditSessionKey());
unset($grouped_product);
unset($attributes);
gc_collect_cycles();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment