Skip to content

Instantly share code, notes, and snippets.

@pmeissner
Forked from pnomolos/shopproduct_extra_options2.php
Created August 29, 2011 13:33
Show Gist options
  • Save pmeissner/1178397 to your computer and use it in GitHub Desktop.
Save pmeissner/1178397 to your computer and use it in GitHub Desktop.
product partial
<? $this->render_partial('shop:product_options'); ?>
<? if (PSInventory_Inventory::out_of_stock( $product, post('product_options') )): ?>
<p>
<strong>
<? $options_string = PSInventory_Data::create_option_string(post('product_extra_options', array()), $product->id);
$data = PSInventory_Data::create()->where('product_id=? AND options_string=?', $product->id, $options_string)->find();
$extended_sku = $data->extended_sku;
?>
We're sorry, the item (size/color/style) you've selected is temporarily out-of-stock.
<a href="<?= site_url('out-of-stock-contact-form') ?>?item=<?= urlencode($extended_sku); ?>" rel="lightbox[external 900 300]" title="Out of Stock Contact Form" id="oosLink" class="button">Notify me</a> when this item becomes available.
</strong>
<? if ($product->expected_availability_date): ?>
<br/>The expected availability date is <strong><?= $product->displayField('expected_availability_date') ?></strong>
<? endif ?>
</p>
<? endif ?>
</div>
@pmeissner
Copy link
Author

Phil, the code you posted didn't seem to return any values. I moved it to where I would it like it to perform it's magic -- on the product_partial.php. But, it highlights the line "$extended_sku = $data->extended_sku;" and says "Trying to get property of non-object"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment