public static function listData($variations)
 {
     $var = array();
     foreach ($variations as $id => $variation) {
         if ($variation->price_adjustion == 0) {
             $var[$variation->id] = sprintf('%s', $variation->title);
         } else {
             $var[$variation->id] = sprintf('%s (%s%s)', $variation->title, $variation->price_adjustion > 0 ? '+' : '', Shop::priceFormat($variation->price_adjustion));
         }
     }
     return $var;
 }
Exemplo n.º 2
0
 /**
  * If $price_absolute is set to true, display the absolute price in 
  * brackets (25 $), otherwise the relative price (+ 5 $)
  */
 public static function listData($variations, $price_absolute = false)
 {
     $var = array();
     foreach ($variations as $id => $variation) {
         if ($price_absolute) {
             $var[$variation->id] = sprintf('<div class="variation">%s</div> <div class="price">%s</div>', $variation->title, Shop::priceFormat($variation->product->getPrice() + $variation->getPriceAdjustion()));
         } else {
             $var[$variation->id] = sprintf('<div class="variation">%s</div> <div class="price">%s%s</div>', $variation->title, $variation->price_adjustion > 0 ? '+' : '', Shop::priceFormat($variation->getPriceAdjustion()));
         }
     }
     return $var;
 }
Exemplo n.º 3
0
 public static function getPriceTotal()
 {
     $price_total = 0;
     $tax_total = 0;
     foreach (Shop::getCartContent() as $product) {
         $model = Products::model()->findByPk($product['product_id']);
         $price_total += $model->getPrice(@$product['Variations'], @$product['amount']);
         $tax_total += $model->getTaxRate(@$product['Variations'], @$product['amount']);
     }
     if ($shipping_method = Shop::getShippingMethod()) {
         $price_total += $shipping_method->price;
     }
     $price_total = Shop::t('Price total: {total}', array('{total}' => Shop::priceFormat($price_total)));
     $price_total .= '<br />';
     $price_total .= Shop::t('All prices are including VAT: {vat}', array('{vat}' => Shop::priceFormat($tax_total))) . '<br />';
     $price_total .= Shop::t('All prices excluding shipping costs') . '<br />';
     return $price_total;
 }
 public function actionUpdateAmount()
 {
     $cart = Shop::getCartContent();
     foreach ($_GET as $key => $value) {
         if (substr($key, 0, 7) == 'amount_') {
             if ($value == '') {
                 return true;
             }
             if (!is_numeric($value) || $value <= 0) {
                 throw new CException('Wrong amount');
             }
             $position = explode('_', $key);
             $position = $position[1];
             if (isset($cart[$position]['amount'])) {
                 $cart[$position]['amount'] = $value;
             }
             $product = Products::model()->findByPk($cart[$position]['product_id']);
             echo Shop::priceFormat(@$product->getPrice($cart[$position]['Variations'], $value));
             return Shop::setCartContent($cart);
         }
     }
 }
Exemplo n.º 5
0
<?php

$this->breadcrumbs = array(Shop::t('Products') => array('index'), $model->title);
?>

<div class="product-header">
    <h2 class="title"><?php 
echo $model->title;
?>
</h2>
    <?php 
printf('<h2 class="price">%s</h2>', Shop::priceFormat($model->price));
?>
</div>

<div class="clear"></div>

<div class="product-images">
<?php 
if ($model->images) {
    foreach ($model->images as $image) {
        $this->renderPartial('/image/view', array('model' => $image));
        echo '<br />';
    }
} else {
    $this->renderPartial('/image/view', array('model' => new Image()));
}
?>
	
</div>
Exemplo n.º 6
0
<div id="shopping-cart">
<div id="shopping-cart-content">
<?php 
if ($products) {
    echo '<h3>' . CHtml::link(Shop::t('Shopping cart'), array('//shop/shoppingCart/view')) . '</h3>';
    echo '<table cellpadding="0" cellspacing="0">';
    foreach ($products as $num => $position) {
        $model = Products::model()->findByPk($position['product_id']);
        printf('<tr>
				<td class="cart-left widget_amount_' . $num . '">%s</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right price_' . $num . '">%s</td></tr>', $position['amount'], $model->title, Shop::priceFormat($position['amount'] * $model->getPrice(@$position['Variations'])));
    }
    if ($shippingMethod = Shop::getShippingMethod()) {
        printf('<tr>
				<td class="cart-left">1</td>
				<td class="cart-middle">%s</td>
				<td class="cart-right">%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->price));
    }
    printf('<tr>
			<td colspan="3" class="cart-right cart-sum price_total"><strong>%s</strong></td>
			</tr>', Shop::getPriceTotal());
    echo '</table>';
}
?>
</div>
<div id="shopping-cart-footer"></div>
</div>
Exemplo n.º 7
0
?>
 

 </table>
	</td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td nowrap> <table width="100%" border="0" cellpadding="3" cellspacing="0">
        <tr> 
          <td nowrap width="100%" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Total value');
?>
              <?php 
echo Shop::priceFormat($model->getTotalPrice());
?>
</font></div></td>
        </tr>
        </table></td>
  </tr>
</table>

<br />
<br />
<br />
<?php 
$this->renderPartial(Shop::module()->footerView);
?>
</div>
Exemplo n.º 8
0
?>
 </h3>
<p> <?php 
echo Shop::t('Choose your Shipping method');
?>
 </p>

<?php 
$i = 0;
foreach (ShippingMethod::model()->findAll() as $method) {
    echo '<div class="row">';
    echo CHtml::radioButton("ShippingMethod", $i == 0, array('value' => $method->id));
    echo '<div class="float-left">';
    echo CHtml::label($method->title, 'ShippingMethod');
    echo CHtml::tag('p', array(), $method->description);
    echo CHtml::tag('p', array(), Shop::t('Price: ') . Shop::priceFormat($method->price));
    echo '</div>';
    echo '</div>';
    echo '<div class="clear"></div>';
    $i++;
}
?>

	

<?php 
Yii::app()->clientScript->registerScript('toggle', "\n\tif(\$('#toggle_delivery').attr('checked'))\n\t\t\$('#delivery_information').show();\n\t\$('#toggle_delivery').click(function() { \n\t\t\$('#delivery_information').toggle(500);\n\t});\n");
?>

    <div class="row buttons">
		<?php 
Exemplo n.º 9
0
                    $img = CHtml::image(Yii::app()->baseUrl . '/' . $variation, '', array('width' => Shop::module()->imageWidthThumb));
                }
            }
            printf('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class="text-right price_single_' . $position . '">%s</td><td class="text-right price_' . $position . '">%s</td><td>%s</td></tr>', $img, CHtml::textField('amount_' . $position, $product['amount'], array('size' => 4, 'class' => 'amount_' . $position)), $model->title, $variations, Shop::priceFormat($model->getPrice($product['Variations'])), Shop::priceFormat($model->getPrice($product['Variations'], $product['amount'])), CHtml::link(Shop::t('Remove'), array('//shop/shoppingCart/delete', 'id' => $position), array('confirm' => Shop::t('Are you sure?'))));
            Yii::app()->clientScript->registerScript('amount_' . $position, "\r\n\t\t\t\t\t\$('.amount_" . $position . "').keyup(function() {\r\n\t\t\t\t\t\t\$.ajax({\r\n\t\t\t\t\t\t\turl:'" . $this->createUrl('//shop/shoppingCart/updateAmount') . "',\r\n\t\t\t\t\t\t\tdata: \$('#amount_" . $position . "'),\r\n\t\t\t\t\t\t\tsuccess: function(result) {\r\n\t\t\t\t\t\t\t\$('.amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').css('background-color', 'lightgreen');\r\n\t\t\t\t\t\t\t\$('.widget_amount_" . $position . "').html(\$('.amount_" . $position . "').val());\r\n\t\t\t\t\t\t\t\$('.price_" . $position . "').html(result);\t\r\n\t\t\t\t\t\t\t\$('.price_total').load('" . $this->createUrl('//shop/shoppingCart/getPriceTotal') . "');\r\n\t\t\t\t\t\t\t\$('.shipping_costs').load('" . $this->createUrl('//shop/shoppingCart/getShippingCosts') . "');\r\n\r\n\t\t\t\t\t\t\t},\r\n\t\t\t\t\t\t\terror: function() {\r\n\t\t\t\t\t\t\t\$('#amount_" . $position . "').css('background-color', 'red');\r\n\t\t\t\t\t\t\t},\r\n\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t});\r\n\t\t\t\t\t");
        }
    }
    if ($shippingMethod = Shop::getShippingMethod()) {
        printf('<tr>
				<td></td>
				<td>1</td>
				<td>%s</td>
				<td></td>
				<td class="text-right shipping_costs">%s</td>
				<td class="text-right shipping_costs">%s</td>
				<td>%s</td></tr>', Shop::t('Shipping costs'), Shop::priceFormat($shippingMethod->getPrice()), Shop::priceFormat($shippingMethod->getPrice()), CHtml::link(Shop::t('edit'), array('//shop/shippingMethod/choose')));
    }
    echo '<tr>
<td class="text-right no-border" colspan="6">
<p class="price_total">' . Shop::getPriceTotal() . '</p></td>
<td class="no-border"></td></tr>';
    echo '</table>';
    ?>

<?php 
    if (Yii::app()->controller->id != 'order') {
        echo '<div class="buttons">';
        echo CHtml::link(Shop::t('Buy additional Products'), array('//shop/products'), array('class' => 'btn-previous'));
        echo CHtml::link(Shop::t('Buy this products'), array('//shop/order/create'), array('class' => 'btn-next'));
        echo '</div>';
    }
Exemplo n.º 10
0
<?php

$methods = ShippingMethod::model()->findAll();
printf('<h2>%s</h2>', Shop::t('Available shipping methods'));
if ($methods) {
    echo '<table>';
    foreach ($methods as $method) {
        printf('<tr><td>%s</td><td>%s</td></tr>', $method->description, Shop::priceFormat($method->price));
    }
    echo '</table>';
}
Exemplo n.º 11
0
$this->pageTitle = $model->title;
Yii::app()->clientScript->registerMetaTag(substr(strip_tags($model->description), 0, 255), 'description');
if ($model->keywords) {
    Yii::app()->clientScript->registerMetaTag(substr(strip_tags($model->keywords), 0, 255), 'keywords');
}
$this->breadcrumbs = array(Shop::t('Products') => array('index'), $model->title);
?>

<div class="product-header">
    <h2 class="title"><?php 
echo $model->title;
?>
</h2>
    <?php 
printf('<h2 class="price">%s %s</h2>', $model->variationCount > 0 ? Shop::pricePrefix() : '', Shop::priceFormat($model->getPrice()));
?>
</div>

<div class="clear"></div>

<div class="product-images">
<?php 
if ($model->images) {
    foreach ($model->images as $image) {
        $this->renderPartial('/image/view', array('model' => $image));
        echo '<br />';
    }
} else {
    $this->renderPartial('/image/view', array('model' => new Image()));
}
Exemplo n.º 12
0
          	<?php 
if ($data->images) {
    $this->renderPartial('/image/view', array('thumb' => true, 'model' => $data->images[0]));
} else {
    echo CHtml::image(Shop::register('no-pic.jpg'));
}
?>
	</div>
    
     <div class="product-overview-description">
        <p> <?php 
echo CHtml::encode($data->description);
?>
 </p>
        <p><strong> <?php 
echo Shop::priceFormat($data->price);
?>
</strong> <br />
        <p><?php 
echo Shop::pricingInfo();
?>
</p>
      
        <p><?php 
echo CHtml::link(Shop::t('show product'), array('products/view', 'id' => $data->product_id), array('class' => 'show-product'));
?>
</p>
    </div>
    
    <div class="clear"></div>
</div>
Exemplo n.º 13
0
    <td nowrap> <table width="100%" border="0" cellpadding="3" cellspacing="0">
        <tr> 
          <td nowrap width="100%" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Total value');
?>
              <?php 
echo Shop::priceFormat($model->getTotalPrice());
?>
</font></div></td>
        </tr>
        <tr> 
          <td nowrap width="100%" style="border-right: 2px solid; border-bottom: 2px solid; border-color: #ffffff;"><div align="right"><font size="1" face="Arial, Helvetica, sans-serif"><?php 
echo Shop::t('Tax amount');
?>
              <?php 
echo Shop::priceFormat($model->getTaxAmount());
?>
</font></div></td>
        </tr>

        </table></td>
  </tr>
</table>

<br />
<br />
<br />

<div id="print-footer">
<?php 
$this->renderPartial(Shop::module()->footerView);