Begin rebuilding variants as simple collateral.
This commit is contained in:
parent
7b4a74fdfe
commit
cdd57ea221
3 changed files with 104 additions and 6 deletions
|
|
@ -602,10 +602,9 @@ sub mergeProductsWithCommerce {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
print "\tMerge old Commerce Products to new SKU based Products.\n" unless ($quiet);
|
print "\tMerge old Commerce Products to new SKU based Products.\n" unless ($quiet);
|
||||||
$session->db->write(<<'EOSQL');
|
$session->db->write(<<'EOSQL');
|
||||||
CREATE TABLE Product_Variants (
|
CREATE TABLE Product_variants (
|
||||||
sku VARCHAR(255) binary NOT NULL primary key,
|
sku VARCHAR(255) BINARY NOT NULL PRIMARY KEY,
|
||||||
mastersku VARCHAR(255) binary NOT NULL,
|
mastersku VARCHAR(255) BINARY NOT NULL,
|
||||||
title VARCHAR(255),
|
|
||||||
shortdesc VARCHAR(30),
|
shortdesc VARCHAR(30),
|
||||||
price FLOAT,
|
price FLOAT,
|
||||||
weight FLOAT,
|
weight FLOAT,
|
||||||
|
|
|
||||||
|
|
@ -898,6 +898,67 @@ sub www_editSpecificationSave {
|
||||||
return $self->www_editSpecification("new");
|
return $self->www_editSpecification("new");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub www_editVariant {
|
||||||
|
my $self = shift;
|
||||||
|
my $sku = shift || $self->session->form->process("sku");
|
||||||
|
return $self->session->privilege->insufficient() unless ($self->canEdit);
|
||||||
|
my ($data, $f, $hashRef);
|
||||||
|
my $i18n = WebGUI::International->new($self->session,'Asset_Product');
|
||||||
|
$data = $self->getCollateral("Product_specification","Product_specificationId",$sku);
|
||||||
|
$f = WebGUI::HTMLForm->new($self->session,-action=>$self->getUrl);
|
||||||
|
$f->readonly(
|
||||||
|
-name => "mastersku",
|
||||||
|
-value => $data->{mastersku},
|
||||||
|
);
|
||||||
|
$f->hidden(
|
||||||
|
-name => "func",
|
||||||
|
-value => "editVariantSave",
|
||||||
|
);
|
||||||
|
$f->integer(
|
||||||
|
-name => "shortdesc",
|
||||||
|
-size => 30,
|
||||||
|
-label => $i18n->get('shortdesc'),
|
||||||
|
-hoverHelp => $i18n->get('shortdesc description'),
|
||||||
|
-value => $data->{price},
|
||||||
|
);
|
||||||
|
$f->integer(
|
||||||
|
-name => "price",
|
||||||
|
-label => $i18n->get(10),
|
||||||
|
-hoverHelp => $i18n->get('10 description'),
|
||||||
|
-value => $data->{price},
|
||||||
|
);
|
||||||
|
$f->float(
|
||||||
|
-name => "weight",
|
||||||
|
-label => $i18n->get('weight'),
|
||||||
|
-hoverHelp => $i18n->get('weight description'),
|
||||||
|
-value => $data->{weight},
|
||||||
|
);
|
||||||
|
$f->integer(
|
||||||
|
-name => "quantity",
|
||||||
|
-label => $i18n->get('quantity'),
|
||||||
|
-hoverHelp => $i18n->get('quantity description'),
|
||||||
|
-value => $data->{quantity},
|
||||||
|
);
|
||||||
|
$f->submit;
|
||||||
|
return $self->getAdminConsole->render($f->print, 'add variant');
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub www_editVariantSave {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->session->privilege->insufficient() unless ($self->canEdit);
|
||||||
|
$self->setCollateral("Product_variants", "Product_specificationId", {
|
||||||
|
Product_specificationId => $self->session->form->process("sid"),
|
||||||
|
shortdesc => $self->session->form->process('shortdesc', 'text'),
|
||||||
|
price => $self->session->form->process('name', 'float'),
|
||||||
|
weight => $self->session->form->process('weight', 'float'),
|
||||||
|
quantity => $self->session->form->process('quantity', 'integer'),
|
||||||
|
});
|
||||||
|
|
||||||
|
return $self->www_editVariant("new");
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_moveAccessoryDown {
|
sub www_moveAccessoryDown {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
||||||
|
|
@ -398,8 +398,8 @@ our $I18N = {
|
||||||
},
|
},
|
||||||
|
|
||||||
'10 description' => {
|
'10 description' => {
|
||||||
message => q|The price of this product. You may optionally enter text like "call for pricing" if you wish, or you may leave it blank.|,
|
message => q|The price of this variant.|,
|
||||||
lastUpdated => 1120332527,
|
lastUpdated => 1209496419,
|
||||||
},
|
},
|
||||||
|
|
||||||
'7 description' => {
|
'7 description' => {
|
||||||
|
|
@ -634,6 +634,44 @@ be useful, others may not.|,
|
||||||
lastUpdated => 1164841201
|
lastUpdated => 1164841201
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'weight' => {
|
||||||
|
message => q|Weight|,
|
||||||
|
context => q|How much something weighs, with no units|
|
||||||
|
lastUpdated => 1209494301,
|
||||||
|
},
|
||||||
|
|
||||||
|
'weight description' => {
|
||||||
|
message => q|The default weight of the variant.|,
|
||||||
|
lastUpdated => 1209494298,
|
||||||
|
},
|
||||||
|
|
||||||
|
'quantity' => {
|
||||||
|
message => q|Quantity|,
|
||||||
|
lastUpdated => 1209494301,
|
||||||
|
},
|
||||||
|
|
||||||
|
'quantity description' => {
|
||||||
|
message => q|How many units of this variant are available.|,
|
||||||
|
lastUpdated => 1209494298,
|
||||||
|
},
|
||||||
|
|
||||||
|
'shortdesc' => {
|
||||||
|
message => q|Short Description|,
|
||||||
|
lastUpdated => 1209494301,
|
||||||
|
},
|
||||||
|
|
||||||
|
'shortdesc description' => {
|
||||||
|
message => q|The will be displayed to the user so they can purchase this variant of your product.|,
|
||||||
|
lastUpdated => 1209494298,
|
||||||
|
},
|
||||||
|
|
||||||
|
'add variant' => {
|
||||||
|
message => q|Add Variant.|,
|
||||||
|
context => q|Add a variant to this product. For example, if you sell shirts, this could be a large shirt, a blue shirt, or
|
||||||
|
a large blue shirt.|,
|
||||||
|
lastUpdated => 1209494298,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue