product macro docs
This commit is contained in:
parent
3b2ea13b57
commit
35b2b94e1d
3 changed files with 128 additions and 1 deletions
25
lib/WebGUI/Help/Macro_Product.pm
Normal file
25
lib/WebGUI/Help/Macro_Product.pm
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
package WebGUI::Help::Macro_Product;
|
||||||
|
|
||||||
|
our $HELP = {
|
||||||
|
|
||||||
|
'product' => {
|
||||||
|
title => 'product title',
|
||||||
|
body => 'product body',
|
||||||
|
fields => [
|
||||||
|
],
|
||||||
|
related => [
|
||||||
|
{
|
||||||
|
tag => 'macros using',
|
||||||
|
namespace => 'Macros'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag => 'manage product',
|
||||||
|
namespace => 'ProductManager'
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ sub process {
|
||||||
($productId) = WebGUI::SQL->quickArray("select productId from products where sku=".quote($_[0])) unless ($productId);
|
($productId) = WebGUI::SQL->quickArray("select productId from products where sku=".quote($_[0])) unless ($productId);
|
||||||
($productId) = WebGUI::SQL->quickArray("select productId from products where productId=".quote($_[0])) unless ($productId);
|
($productId) = WebGUI::SQL->quickArray("select productId from products where productId=".quote($_[0])) unless ($productId);
|
||||||
|
|
||||||
return 'Cannot find product' unless ($productId);
|
return WebGUI::International::get('cannot find product','Macro_Product') unless ($productId);
|
||||||
|
|
||||||
$product = WebGUI::Product->new($productId);
|
$product = WebGUI::Product->new($productId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,108 @@ our $I18N = {
|
||||||
message => q|Product|,
|
message => q|Product|,
|
||||||
lastUpdated => 1128918830,
|
lastUpdated => 1128918830,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
'cannot find product' => {
|
||||||
|
message => q|Cannot find product|,
|
||||||
|
lastUpdated => 1128976376,
|
||||||
|
},
|
||||||
|
|
||||||
|
'product title' => {
|
||||||
|
message => q|Product Macro|,
|
||||||
|
lastUpdated => 1128965480,
|
||||||
|
},
|
||||||
|
|
||||||
|
'product body' => {
|
||||||
|
message => q|
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<b>^Product(<i>SKU or productId</i>, [<i>templateId</i>]);</b><br>
|
||||||
|
This macro looks up a Product in the Product Manager by SKU or productId and
|
||||||
|
allows information about i to be displayed. If the SKU or productId cannot
|
||||||
|
be found, the message ^International("cannot find product","Macro_Product"); will
|
||||||
|
be displayed.</p>
|
||||||
|
<p>The macro may take one optional argument, an alternate template in the Macro/Product namespace for formatting information about the Product. The following variables are available in the template:</p>
|
||||||
|
|
||||||
|
<p><b>variants.message</b><br />
|
||||||
|
The internationalized text "^International("available product configurations","Macro_Product");"
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variantLoop</b><br />
|
||||||
|
A loop containing information about all variants about the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<quote>
|
||||||
|
|
||||||
|
<p><b>variant.compositionLoop</b><br />
|
||||||
|
A loop containing information about all variants about the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<quote>
|
||||||
|
|
||||||
|
<p><b>parameter</b><br />
|
||||||
|
The parameter that defines this variant, for example, size.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>value</b><br />
|
||||||
|
The value of the parameter, for the example of size, XL.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</quote>
|
||||||
|
|
||||||
|
<p><b>variant.variantId</b><br />
|
||||||
|
The Id for this variant of the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variant.price</b><br />
|
||||||
|
The price for this variant of the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variant.weight</b><br />
|
||||||
|
The weight for this variant of the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variant.sku</b><br />
|
||||||
|
The SKU for this variant of the Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variant.addToCart.url</b><br />
|
||||||
|
A URL to add this variant of the Product to the user's shopping cart.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>variant.addToCart.label</b><br />
|
||||||
|
An internationalized label, "^International("add to cart","Macro_Product");",
|
||||||
|
to display to the user for adding this variant
|
||||||
|
of the Product to their shopping cart.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</quote>
|
||||||
|
|
||||||
|
<p><b>productId</b><br />
|
||||||
|
The unique identifier of this Product.</p>
|
||||||
|
|
||||||
|
<p><b>title</b><br />
|
||||||
|
The title for this Product.</p>
|
||||||
|
|
||||||
|
<p><b>description</b><br />
|
||||||
|
The description of this Product.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>price</b><br />
|
||||||
|
The Product's base cost.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>weight</b><br />
|
||||||
|
The Product's base weight.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p><b>sku</b><br />
|
||||||
|
The Product's base SKU.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|,
|
||||||
|
lastUpdated => 1128986411,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue