当前位置: 首页>>代码示例>>PHP>>正文


PHP Shop::priceFormat方法代码示例

本文整理汇总了PHP中Shop::priceFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::priceFormat方法的具体用法?PHP Shop::priceFormat怎么用?PHP Shop::priceFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shop的用法示例。


在下文中一共展示了Shop::priceFormat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listData

 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;
 }
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:12,代码来源:ProductVariation.php

示例2: listData

 /**
  * 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;
 }
开发者ID:rinodung,项目名称:yii-shop,代码行数:16,代码来源:ProductVariation.php

示例3: getPriceTotal

 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;
 }
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:18,代码来源:Shop.php

示例4: actionUpdateAmount

 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);
         }
     }
 }
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:22,代码来源:ShoppingCartController.php

示例5: array

<?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>
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:30,代码来源:view.php

示例6: array

<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>
开发者ID:rinodung,项目名称:yii-shop,代码行数:28,代码来源:shopping_cart.php

示例7:

?>
 

 </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>
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:30,代码来源:invoice.php

示例8: foreach

?>
 </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 
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:31,代码来源:choose.php

示例9: array

                    $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>';
    }
开发者ID:axetion007,项目名称:yii-shop,代码行数:31,代码来源:view.php

示例10: printf

<?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>';
}
开发者ID:axetion007,项目名称:yii-shop,代码行数:11,代码来源:index.php

示例11: array

$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()));
}
开发者ID:rinodung,项目名称:yii-shop,代码行数:30,代码来源:view.php

示例12: array

          	<?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>
开发者ID:huynhchanhuy,项目名称:yii_shopping,代码行数:31,代码来源:_view.php

示例13:

    <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);
开发者ID:axetion007,项目名称:yii-shop,代码行数:31,代码来源:invoice.php


注:本文中的Shop::priceFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。