From 845f4464ca3e7ad9c1f172b0e38ab660829c9e32 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 10 Aug 2002 20:01:43 +0000 Subject: [PATCH] Added product templates. --- docs/upgrades/upgrade_4.4.1-4.5.0.sql | 26 ++ lib/WebGUI/Wobject/Product.pm | 437 +++++++++++++++++++++++++- 2 files changed, 453 insertions(+), 10 deletions(-) diff --git a/docs/upgrades/upgrade_4.4.1-4.5.0.sql b/docs/upgrades/upgrade_4.4.1-4.5.0.sql index 85dd105f8..a22574b26 100644 --- a/docs/upgrades/upgrade_4.4.1-4.5.0.sql +++ b/docs/upgrades/upgrade_4.4.1-4.5.0.sql @@ -41,6 +41,32 @@ insert into international values (713,'WebGUI',1,'Style Managers Group'); insert into international values (714,'WebGUI',1,'Template Managers Group'); delete from settings where name='onCriticalError'; update international set message='Add a new image group.' where internationalId=543 and namespace='WebGUI' and languageId=1; +insert into international values (48,'Product',1,'Are you certain you wish to delete this benefit? It cannot be recovered once it has been deleted.'); +insert into incrementer values ('productBenefitId',1000); +insert into incrementer values ('productTemplateId',1000); +create table Product_benefit (wobjectId int not null, productBenefitId int not null primary key, benefit varchar(255), sequenceNumber int not null); +insert into international values (51,'Product',1,'Benefit'); +insert into international values (52,'Product',1,'Add another benefit?'); +insert into international values (53,'Product',1,'Edit Benefit'); +insert into international values (54,'Product',1,'Benefits'); +insert into international values (55,'Product',1,'Add a benefit.'); +insert into international values (56,'Product',1,'Add a product template.'); +insert into international values (57,'Product',1,'Are you certain you wish to delete this template and set all the products using it to the default template?'); +insert into international values (58,'Product',1,'Edit Product Template'); +insert into international values (59,'Product',1,'Name'); +insert into international values (60,'Product',1,'Template'); +alter table Product add column productTemplateId int not null default 1; +insert into international values (61,'Product',1,'Product Template'); +create table Product_template (productTemplateId int not null primary key, name varchar(255), template text); + + + + + + + + + diff --git a/lib/WebGUI/Wobject/Product.pm b/lib/WebGUI/Wobject/Product.pm index 54d8b4ed1..6a9b6c051 100644 --- a/lib/WebGUI/Wobject/Product.pm +++ b/lib/WebGUI/Wobject/Product.pm @@ -87,7 +87,7 @@ sub _layoutStandard { $column[$i] = ''; $column[$i] .= '
'.WebGUI::International::get(30,$namespace).'
'; if ($session{var}{adminOn}) { - $column[$i] .= 'get("wobjectId")).'">'.WebGUI::International::get(34,$namespace).'

'; } } @@ -105,6 +105,30 @@ sub _layoutStandard { $i++; } $sth->finish; + $sth = WebGUI::SQL->read("select benefit,productBenefitId from Product_benefit where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); + $rows = $sth->rows; + if ($rows > 0 || $session{var}{adminOn}) { + $column[$i] = ''; + $column[$i] .= '

'.WebGUI::International::get(54,$namespace).'
'; + if ($session{var}{adminOn}) { + $column[$i] .= ''.WebGUI::International::get(55,$namespace).'

'; + } + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $column[$i] .= deleteIcon('func=deleteBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .editIcon('func=editBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .moveUpIcon('func=moveBenefitUp&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .moveDownIcon('func=moveBenefitDown&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}); + } + $column[$i] .= '·'.$data{benefit}.'
'; + } + if ($rows > 0 || $session{var}{adminOn}) { + $column[$i] .= ''; + $i++; + } + $sth->finish; $sth = WebGUI::SQL->read("select name,value,units,productSpecificationId from Product_specification where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); $rows = $sth->rows; @@ -200,6 +224,18 @@ sub _reorderAccessories { $sth->finish; } +#------------------------------------------------------------------- +sub _reorderBenefits { + my ($sth, $i, $id); + $sth = WebGUI::SQL->read("select productBenefitId from + Product_benefit where wobjectId=$_[0] order by sequenceNumber"); + while (($id) = $sth->array) { + WebGUI::SQL->write("update Product_benefit set sequenceNumber='$i' where productBenefitId=$id"); + $i++; + } + $sth->finish; +} + #------------------------------------------------------------------- sub _reorderFeatures { my ($sth, $i, $id); @@ -251,6 +287,7 @@ sub duplicate { manual=>$_[0]->get("manual"), brochure=>$_[0]->get("brochure"), price=>$_[0]->get("price"), + productTemplateId=>$_[0]->get("productTemplateId"), productNumber=>$_[0]->get("productNumber") }); $file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId")); @@ -272,6 +309,13 @@ sub duplicate { .quote($data{feature}).", $data{sequenceNumber})"); } $sth->finish; + $sth = WebGUI::SQL->read("select * from Product_benefit where wobjectId=".$_[0]->get("wobjectId")); + while (%data = $sth->hash) { + $newId = getNextId("productBenefitId"); + WebGUI::SQL->write("insert into Product_benefit values (".$w->get("wobjectId").", $newId, " + .quote($data{benefit}).", $data{sequenceNumber})"); + } + $sth->finish; $sth = WebGUI::SQL->read("select * from Product_specification where wobjectId=".$_[0]->get("wobjectId")); while (%data = $sth->hash) { $newId = getNextId("productSpecificationId"); @@ -308,6 +352,7 @@ sub purge { or accessoryWobjectId=".$_[0]->get("wobjectId")); WebGUI::SQL->write("delete from Product_related where wobjectId=".$_[0]->get("wobjectId")." or relatedWobjectId=".$_[0]->get("wobjectId")); + WebGUI::SQL->write("delete from Product_benefit where wobjectId=".$_[0]->get("wobjectId")); WebGUI::SQL->write("delete from Product_feature where wobjectId=".$_[0]->get("wobjectId")); WebGUI::SQL->write("delete from Product_specification where wobjectId=".$_[0]->get("wobjectId")); $_[0]->SUPER::purge(); @@ -315,7 +360,7 @@ sub purge { #------------------------------------------------------------------- sub set { - $_[0]->SUPER::set($_[1],[qw(price productNumber image1 image2 image3 manual brochure warranty)]); + $_[0]->SUPER::set($_[1],[qw(price productTemplateId productNumber image1 image2 image3 manual brochure warranty)]); } #------------------------------------------------------------------- @@ -414,6 +459,20 @@ sub www_copy { } } +#------------------------------------------------------------------- +sub www_copyTemplate { + my (%data); + tie %data, 'Tie::CPHash'; + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from Product_template where productTemplateId=".$session{form}{tid}); + WebGUI::SQL->write("insert into Product_template values (".getNextId("productTemplateId")."," + .quote("Copy of ".$data{name}).",".quote($data{template}).")"); + return $_[0]->www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_deleteAccessory { my ($output); @@ -442,6 +501,33 @@ sub www_deleteAccessoryConfirm { } } +#------------------------------------------------------------------- +sub www_deleteBenefit { + my ($output); + if (WebGUI::Privilege::canEditPage()) { + $output = '

'.WebGUI::International::get(42).'

'; + $output .= WebGUI::International::get(48,$namespace).'

'; + $output .= '

'.WebGUI::International::get(44).''; + $output .= '   '.WebGUI::International::get(45).'
'; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteBenefitConfirm { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("delete from Product_benefit where productBenefitId=$session{form}{bid}"); + _reorderBenefits($_[0]->get("wobjectId")); + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_deleteFeature { my ($output); @@ -550,9 +636,38 @@ sub www_deleteSpecificationConfirm { } } +#------------------------------------------------------------------- +sub www_deleteTemplate { + my ($output); + if ($session{form}{tid} < 1000) { + return WebGUI::Privilege::vitalComponent(); + } elsif (WebGUI::Privilege::canEditPage()) { + $output = '

'.WebGUI::International::get(42).'

'; + $output .= WebGUI::International::get(57,$namespace).'

'; + $output .= '

'.WebGUI::International::get(44).''; + $output .= '   '.WebGUI::International::get(45).'
'; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_deleteTemplateConfirm { + if (WebGUI::Privilege::canEditPage()) { + WebGUI::SQL->write("delete from Product_template where productTemplateId=$session{form}{tid}"); + WebGUI::SQL->write("update Product set productTemplateId=1 where productTemplateId=$session{form}{tid}"); + return $_[0]->www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_edit { - my ($f, $output, $proceed); + my ($f, $output, $proceed, %data, $sth, $templates); if (WebGUI::Privilege::canEditPage()) { $output = helpIcon(1,$namespace); $output .= '

'.WebGUI::International::get(6,$namespace).'

'; @@ -565,7 +680,23 @@ sub www_edit { $f->raw(_fileProperty("brochure",13,$_[0]->get("brochure"))); $f->raw(_fileProperty("manual",14,$_[0]->get("manual"))); $f->raw(_fileProperty("warranty",15,$_[0]->get("warranty"))); + $templates = WebGUI::SQL->buildHashRef("select productTemplateId,name from Product_template order by name"); + $f->select("productTemplateId",$templates,WebGUI::International::get(61,$namespace),[$_[0]->get("productTemplateId")]); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); + unless ($_[0]->get("wobjectId") eq "new") { + $output .= '

'; + $output .= '' + .WebGUI::International::get(56,$namespace).'

'; + tie %data, 'Tie::CPHash'; + $sth = WebGUI::SQL->read("select productTemplateId,name from Product_template order by name"); + while (%data = $sth->hash) { + $output .= deleteIcon('func=deleteTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId}) + .editIcon('func=editTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId}) + .copyIcon('func=copyTemplate&wid='.$_[0]->get("wobjectId").'&tid='.$data{productTemplateId}) + .' '.$data{name}.'
'; + } + $sth->finish; + } return $output; } else { return WebGUI::Privilege::insufficient(); @@ -595,6 +726,7 @@ sub www_editSave { $file = WebGUI::Attachment->new("",$_[0]->get("wobjectId")); $file->save("warranty"); $property{warranty}=$file->getFilename("warranty") if ($file->getFilename("warranty") ne ""); + $property{productTemplateId}=$session{form}{productTemplateId}; $property{price}=$session{form}{price}; $property{productNumber}=$session{form}{productNumber}; $_[0]->set(\%property); @@ -604,6 +736,57 @@ sub www_editSave { } } +#------------------------------------------------------------------- +sub www_editBenefit { + my ($output, %data, $f, $benefits); + tie %data, 'Tie::CPHash'; + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from Product_benefit where + productBenefitId='$session{form}{bid}'"); + $output = helpIcon(6,$namespace); + $output .= '

'.WebGUI::International::get(53,$namespace).'

'; + $f = WebGUI::HTMLForm->new; + $f->hidden("wid",$_[0]->get("wobjectId")); + $session{form}{bid} = "new" if ($session{form}{bid} eq ""); + $f->hidden("bid",$session{form}{bid}); + $f->hidden("func","editBenefitSave"); + $benefits = WebGUI::SQL->buildHashRef("select benefit,benefit from Product_benefit order by benefit"); + $f->combo("benefit",$benefits,WebGUI::International::get(51,$namespace),[$data{benefits}]); + $f->yesNo("proceed",WebGUI::International::get(52,$namespace)); + $f->submit; + $output .= $f->print; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editBenefitSave { + my ($seq); + if (WebGUI::Privilege::canEditPage()) { + if ($session{form}{bid} eq "new") { + ($seq) = WebGUI::SQL->quickArray("select max(sequenceNumber) from Product_benefit + where wobjectId=".$_[0]->get("wobjectId")); + $session{form}{bid} = getNextId("productBenefitId"); + WebGUI::SQL->write("insert into Product_benefit (wobjectId,productBenefitId,sequenceNumber) values + (".$_[0]->get("wobjectId").",$session{form}{bid},".($seq+1).")"); + } + $session{form}{benefit} = $session{form}{benefit_new} if ($session{form}{benefit_new} ne ""); + WebGUI::SQL->write("update Product_benefit set benefit=".quote($session{form}{benefit})." + where productBenefitId=$session{form}{bid}"); + if ($session{form}{proceed}) { + $session{form}{bid} = "new"; + return $_[0]->www_editBenefit(); + } else { + return ""; + } + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_editFeature { my ($output, %data, $f, $features); @@ -711,6 +894,45 @@ sub www_editSpecificationSave { } } +#------------------------------------------------------------------- +sub www_editTemplate { + my ($output, %data, $f); + tie %data, 'Tie::CPHash'; + if (WebGUI::Privilege::canEditPage()) { + %data = WebGUI::SQL->quickHash("select * from Product_template where productTemplateId='$session{form}{tid}'"); + $output = helpIcon(3,$namespace); + $output .= '

'.WebGUI::International::get(58,$namespace).'

'; + $f = WebGUI::HTMLForm->new; + $f->hidden("wid",$_[0]->get("wobjectId")); + $session{form}{tid} = "new" if ($session{form}{tid} eq ""); + $f->hidden("tid",$session{form}{tid}); + $f->hidden("func","editTemplateSave"); + $f->text("name",WebGUI::International::get(59,$namespace),$data{name}); + $f->HTMLArea("template",WebGUI::International::get(60,$namespace),$data{template},'','','',($session{setting}{textAreaRows}+10)); + $f->submit; + $output .= $f->print; + return $output; + } else { + return WebGUI::Privilege::insufficient(); + } + return $output; +} + +#------------------------------------------------------------------- +sub www_editTemplateSave { + if (WebGUI::Privilege::canEditPage()) { + if ($session{form}{tid} eq "new") { + $session{form}{tid} = getNextId("productTemplateId"); + WebGUI::SQL->write("insert into Product_template (productTemplateId) values ($session{form}{tid})"); + } + WebGUI::SQL->write("update Product_template set name=".quote($session{form}{name}).", + template=".quote($session{form}{template})." where productTemplateId=$session{form}{tid}"); + return $_[0]->www_edit(); + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_moveAccessoryDown { my ($id, $seq); @@ -751,6 +973,44 @@ sub www_moveAccessoryUp { } } +#------------------------------------------------------------------- +sub www_moveBenefitDown { + my ($id, $seq); + if (WebGUI::Privilege::canEditPage()) { + ($seq) = WebGUI::SQL->quickArray("select sequenceNumber from Product_benefit + where productBenefitId=$session{form}{bid}"); + ($id) = WebGUI::SQL->quickArray("select productBenefitId from Product_benefit + where wobjectId=".$_[0]->get("wobjectId")." and sequenceNumber=$seq+1 group by wobjectId"); + if ($id ne "") { + WebGUI::SQL->write("update Product_benefit set sequenceNumber=sequenceNumber+1 + where productBenefitId=$session{form}{bid}"); + WebGUI::SQL->write("update Product_benefit set sequenceNumber=sequenceNumber-1 where productBenefitId=$id"); + } + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + +#------------------------------------------------------------------- +sub www_moveBenefitUp { + my ($id, $seq); + if (WebGUI::Privilege::canEditPage()) { + ($seq) = WebGUI::SQL->quickArray("select sequenceNumber from Product_benefit + where productBenefitId=$session{form}{bid}"); + ($id) = WebGUI::SQL->quickArray("select productBenefitId from Product_benefit + where wobjectId=".$_[0]->get("wobjectId")." and sequenceNumber=$seq-1 group by wobjectId"); + if ($id ne "") { + WebGUI::SQL->write("update Product_benefit set sequenceNumber=sequenceNumber-1 + where productBenefitId=$session{form}{bid}"); + WebGUI::SQL->write("update Product_benefit set sequenceNumber=sequenceNumber+1 where productBenefitId=$id"); + } + return ""; + } else { + return WebGUI::Privilege::insufficient(); + } +} + #------------------------------------------------------------------- sub www_moveFeatureDown { my ($id, $seq); @@ -872,14 +1132,171 @@ sub www_moveSpecificationUp { #------------------------------------------------------------------- sub www_view { - my ($output); - if ($_[0]->get("layout") eq "something") { - return $_[0]->_layoutSomething; - } elsif ($_[0]->get("layout") eq "somethingelse") { - return $_[0]->_layoutSomethingelse; - } else { - return $_[0]->_layoutStandard; + my ($output, %data, $sth, $rows, $file, $i, $segment, $template); + tie %data, 'Tie::CPHash'; + $output = $_[0]->displayTitle; + ($template) = WebGUI::SQL->quickArray("select template from Product_template where productTemplateId=".$_[0]->get("productTemplateId")); + #---product description + $segment = $_[0]->description; + $template =~ s/\^Product_Description\;/$segment/; + #---product price + $segment = $_[0]->get("price"); + $template =~ s/\^Product_Price\;/$segment/; + #---product number + $segment = $_[0]->get("productNumber"); + $template =~ s/\^Product_Number\;/$segment/; + #---product brochure + if ($_[0]->get("brochure")) { + $file = WebGUI::Attachment->new($_[0]->get("brochure"),$_[0]->get("wobjectId")); + $segment = ' ' + .WebGUI::International::get(13,$namespace).''; + $template =~ s/\^Product_Brochure\;/$segment/; } + #---product manual + if ($_[0]->get("manual")) { + $file = WebGUI::Attachment->new($_[0]->get("manual"),$_[0]->get("wobjectId")); + $segment = ' ' + .WebGUI::International::get(14,$namespace).''; + $template =~ s/\^Product_Manual\;/$segment/; + } + #---product warranty + if ($_[0]->get("warranty")) { + $file = WebGUI::Attachment->new($_[0]->get("warranty"),$_[0]->get("wobjectId")); + $segment = ' ' + .WebGUI::International::get(15,$namespace).''; + $template =~ s/\^Product_Warranty\;/$segment/; + } + #---product thumbnail1 + if ($_[0]->get("image1")) { + $file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Thumbnail1\;/$segment/; + } + #---product thumbnail2 + if ($_[0]->get("image2")) { + $file = WebGUI::Attachment->new($_[0]->get("image2"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Thumbnail2\;/$segment/; + } + #---product thumbnail3 + if ($_[0]->get("image3")) { + $file = WebGUI::Attachment->new($_[0]->get("image3"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Thumbnail3\;/$segment/; + } + #---product image1 + if ($_[0]->get("image1")) { + $file = WebGUI::Attachment->new($_[0]->get("image1"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Image1\;/$segment/; + } + #---product image2 + if ($_[0]->get("image2")) { + $file = WebGUI::Attachment->new($_[0]->get("image2"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Image2\;/$segment/; + } + #---product image3 + if ($_[0]->get("image3")) { + $file = WebGUI::Attachment->new($_[0]->get("image3"),$_[0]->get("wobjectId")); + $segment = ''; + $template =~ s/\^Product_Image3\;/$segment/; + } + #---product features + $segment = ""; + $sth = WebGUI::SQL->read("select feature,productFeatureId from Product_feature where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); + if ($session{var}{adminOn}) { + $segment .= ''.WebGUI::International::get(34,$namespace).'

'; + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $segment .= deleteIcon('func=deleteFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId}) + .editIcon('func=editFeature&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId}) + .moveUpIcon('func=moveFeatureUp&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId}) + .moveDownIcon('func=moveFeatureDown&wid='.$_[0]->get("wobjectId").'&fid='.$data{productFeatureId}); + } + $segment .= '·'.$data{feature}.'
'; + } + $sth->finish; + $template =~ s/\^Product_Features\;/$segment/; + #---product benefits + $segment = ""; + $sth = WebGUI::SQL->read("select benefit,productBenefitId from Product_benefit where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); + if ($session{var}{adminOn}) { + $segment .= ''.WebGUI::International::get(55,$namespace).'

'; + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $segment .= deleteIcon('func=deleteBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .editIcon('func=editBenefit&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .moveUpIcon('func=moveBenefitUp&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}) + .moveDownIcon('func=moveBenefitDown&wid='.$_[0]->get("wobjectId").'&bid='.$data{productBenefitId}); + } + $segment.= '·'.$data{benefit}.'
'; + } + $sth->finish; + $template =~ s/\^Product_Benefits\;/$segment/; + #---product specifications + $segment = ""; + $sth = WebGUI::SQL->read("select name,value,units,productSpecificationId from Product_specification + where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); + if ($session{var}{adminOn}) { + $segment .= ''.WebGUI::International::get(35,$namespace).'

'; + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $segment .= deleteIcon('func=deleteSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId}) + .editIcon('func=editSpecification&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId}) + .moveUpIcon('func=moveSpecificationUp&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId}) + .moveDownIcon('func=moveSpecificationDown&wid='.$_[0]->get("wobjectId").'&sid='.$data{productSpecificationId}); + } + $segment .= '·'.$data{name}.': '.$data{value}.' '.$data{units}.'
'; + } + $sth->finish; + $template =~ s/\^Product_Specifications\;/$segment/; + #---product accessories + $segment = ""; + $sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_accessory.accessoryWobjectId from Product_accessory,wobject,page + where Product_accessory.wobjectId=".$_[0]->get("wobjectId")." + and Product_accessory.accessoryWobjectId=wobject.wobjectId and wobject.pageId=page.pageId order by Product_accessory.sequenceNumber"); + if ($session{var}{adminOn}) { + $segment .= ''.WebGUI::International::get(36,$namespace).'

'; + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $segment .= deleteIcon('func=deleteAccessory&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId}) + .moveUpIcon('func=moveAccessoryUp&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId}) + .moveDownIcon('func=moveAccessoryDown&wid='.$_[0]->get("wobjectId").'&aid='.$data{accessoryWobjectId}); + } + $segment .= '·'.$data{title}.'
'; + } + $sth->finish; + $template =~ s/\^Product_Accessories\;/$segment/; + #---product related + $segment = ""; + $sth = WebGUI::SQL->read("select wobject.title,page.urlizedTitle,Product_related.relatedWobjectId from Product_related,wobject,page + where Product_related.wobjectId=".$_[0]->get("wobjectId")." + and Product_related.relatedWobjectId=wobject.wobjectId and wobject.pageId=page.pageId order by Product_related.sequenceNumber"); + if ($session{var}{adminOn}) { + $segment .= ''.WebGUI::International::get(37,$namespace).'

'; + } + while (%data = $sth->hash) { + if ($session{var}{adminOn}) { + $segment .= deleteIcon('func=deleteRelated&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId}) + .moveUpIcon('func=moveRelatedUp&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId}) + .moveDownIcon('func=moveRelatedDown&wid='.$_[0]->get("wobjectId").'&rid='.$data{relatedWobjectId}); + } + $segment .= '·'.$data{title}.'
'; + } + $sth->finish; + $template =~ s/\^Product_Related\;/$segment/; + $output .= $template; + return $_[0]->processMacros($output); }