Last active
September 2, 2015 18:31
-
-
Save scottwalters/cbd175e40a937c68826c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
in a method in a Content Handler: | |
my $cart = WebGUI::Shop->Cart->newBySession($session); | |
my $asset_id = $session->db->quickScalar("select assetId from sku where sku = ?", [ $session->request->param('sku')) ]); | |
my $product; | |
if( $asset_id ) { | |
$product = WebGUI::Asset::Sku::Product->newById($session, $asset_id); | |
} else { | |
$product = WebGUI::Asset::Sku::Product->new($session); | |
} | |
# update $product from other post/get data here, or from pulling data from another database here | |
# make sure to do $product->update({ }) with all data including the sku; the sku will match for existing products but it needs to be set if we just created this | |
$cart->addItem($product); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment