/** * @param Product $product * @param integer $qtd */ public function __construct(Product $product, $qtd) { parent::__construct(); $resourceBundle = Application::getInstance()->getBundle(); $idProduct = $product->getIdProduct(); $moneyformat = $resourceBundle->getString('MONEY_FORMAT'); $productName = $product->getProductName(); $productDescription = $product->getProductDescription(); $productPrice = $product->getProductPrice(); $form = $this->addChild(new Form('/?c=cart&a=change&p=' . $idProduct)); //Imagem do produto $form->addChild(new Image($product->getProductImage(), $productName))->setTitle($productName)->setAttribute('width', 80)->setAttribute('height', 80); //Nome e descrição do produto $form->addChild(new Span())->addStyle('name')->addChild(new Text($productName)); $form->addChild(new Span())->addStyle('desc')->addChild(new Text($productDescription)); //Input com a quantidade de itens $form->addChild(new Label(new Text($resourceBundle->getString('QUANTITY'))))->addChild(new Input('qtd'))->setValue($qtd); //Preço unitário $form->addChild(new Span())->addStyle('price')->addChild(new Text(money_format($moneyformat, $productPrice))); //Preço total $form->addChild(new Span())->addStyle('total')->addChild(new Text(money_format($moneyformat, $qtd * $productPrice))); //Botões para edição e exclusão do item do carrinho $form->addChild(new Input('save', Input::SUBMIT))->setValue($resourceBundle->getString('SAVE')); $form->addChild(new Input('del', Input::SUBMIT))->setValue($resourceBundle->getString('DELETE')); }
/** * @param Product $product */ public function __construct(Product $product) { parent::__construct(); $resourceBundle = Application::getInstance()->getBundle(); $productName = $product->getProductName(); $moneyFormat = $resourceBundle->getString('MONEY_FORMAT'); $buy = $resourceBundle->getString('BUY'); $definitionList = $this->addChild(new DefinitionList()); $definitionList->addChild(new DefinitionTerm())->addChild(new Text($productName)); $definitionList->addChild(new DefinitionDescription())->addStyle('description')->addChild(new Text($product->getProductDescription())); $definitionList->addChild(new DefinitionDescription())->addStyle('image')->addChild(new Image($product->getProductImage(), $productName))->setAttribute('width', 190)->setAttribute('height', 190)->setTitle($productName); $definitionList->addChild(new DefinitionDescription())->addStyle('price')->addChild(new Text(money_format($moneyFormat, $product->getProductPrice()))); $this->addChild(new Anchor('/?c=cart&a=add&p=' . $product->getIdProduct()))->setTitle($buy)->addStyle('buy-button')->addChild(new Text($buy)); }