<?php
if
(
$_product
->isSaleable()): ?>
<form action=
"<?php echo Mage::getBaseUrl(); ?>checkout/cart/add/"
method=
"post"
id=
"product_addtocart_form_<?php echo $_product->getId() ?>"
<?php
if
(
$_product
->getOptions()): ?> enctype=
"multipart/form-data"
<?php
endif
; ?>>
<fieldset
class
=
"no-display"
>
<input type=
"hidden"
name=
"product"
value=
"<?php echo $_product->getId() ?>"
/>
<input type=
"hidden"
name=
"related_product"
id=
"related-products-field"
value=
""
/>
</fieldset>
<?php
$product
= Mage::getModel(
'catalog/product'
); ?>
<?php
$product
->load(
$_product
->getId()); ?>
<?php
$sandy
=
""
;
$attVal
=
$product
->getOptions();
if
(sizeof(
$attVal
)) {
foreach
(
$attVal
as
$optionVal
) {
$sandy
.=
$optionVal
->getTitle().
": "
;
$sandy
.=
"<select name='options["
.
$optionVal
->getId().
"]'>"
;
foreach
(
$optionVal
->getValues()
as
$valuesKey
=>
$valuesVal
) {
$sandy
.=
"<option price='"
.
$valuesVal
->getPrice(true).
"' value='"
.
$valuesVal
->getId().
"'>"
.
$valuesVal
->getTitle() .
'+'
.
$valuesVal
->getPrice(true) .
"</option>"
;
}
$sandy
.=
"</select>"
;
}
}
echo
$sandy
;
?>
<?php
echo
$this
->getPriceHtml(
$_product
, true) ?>
<?php
<?php
if
(!
$_product
->isGrouped()): ?>
<label>Qty:</label>
<input name=
"qty"
type=
"text"
id=
"qty"
maxlength=
"12"
value=
"<?php echo $this->getMinimalQty($_product)==null?1:$this->getMinimalQty($_product) ?>"
/>
<button type=
"button"
onclick=
"productAddToCartForm<?php echo $_product->getId() ?>.submit()"
>Add to Cart</button>
<?php
endif
; ?>
</form>
<script type=
"text/javascript"
>
var
productAddToCartForm<?php
echo
$_product
->getId() ?> =
new
VarienForm(
'product_addtocart_form_<?php echo $_product->getId() ?>'
);
productAddToCartForm<?php
echo
$_product
->getId() ?>.submit =
function
(){
if
(this.validator.validate()) {
this.form.submit();
}
}.bind(productAddToCartForm<?php
echo
$_product
->getId() ?>);
</script>
<?php
else
: ?>
<div
class
=
"out-of-stock"
><?php
echo
$this
->__(
'Out of stock'
) ?></div>
<?php
endif
; ?>
No comments:
Post a Comment