本文整理汇总了PHP中Varien_Object::getPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::getPrice方法的具体用法?PHP Varien_Object::getPrice怎么用?PHP Varien_Object::getPrice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::getPrice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getFinalPrice
protected function _getFinalPrice($product, $price)
{
$discountedObj = new Varien_Object(array('price' => $price, 'discounted' => false));
Mage::dispatchEvent('affiliateplus_product_get_final_price', array('product' => $product, 'discounted_obj' => $discountedObj));
if ($discountedObj->getDiscounted()) {
return $discountedObj->getPrice();
}
$price = $discountedObj->getPrice();
$discountType = $this->_getConfigHelper()->getDiscountConfig('discount_type');
$discountValue = $this->_getConfigHelper()->getDiscountConfig('discount');
if (Mage::helper('affiliateplus/cookie')->getNumberOrdered()) {
if ($this->_getConfigHelper()->getDiscountConfig('use_secondary')) {
$discountType = $this->_getConfigHelper()->getDiscountConfig('secondary_type');
$discountValue = $this->_getConfigHelper()->getDiscountConfig('secondary_discount');
}
}
if ($discountType == 'fixed' || $discountType == 'cart_fixed') {
$price -= floatval($discountValue);
} elseif ($discountType == 'percentage') {
$price -= floatval($discountValue) / 100 * $price;
}
if ($price < 0) {
return 0;
}
return $price;
}
示例2: _getValue
public function _getValue(Varien_Object $row)
{
$value = '<span id="price_label_' . $row->getId() . '" data-id="' . $row->getId() . '">' . $this->helper('core')->formatPrice($row->getPrice(), false) . '</span>';
$value .= '<input type="text" id="price_value_' . $row->getId() . '" name="price_value[' . $row->getId() . ']" data-id="' . $row->getId() . '" value="' . number_format($row->getPrice(), 2) . '" style="width: 100px;margin-right: 2px;display:none">';
$value .= '<button id="price_button_' . $row->getId() . '" data-id="' . $row->getId() . '" onclick="vcUpdateInfor(' . $row->getId() . ',\'price\')" style="display:none"><span><span>Update</span></span></button>';
$value .= '<img id="price_waiting_' . $row->getId() . '" src="' . $this->getSkinUrl('vc_easyupdateproductinfor/images/ajax-loader.gif') . '" class="v-middle" style="display:none" />';
return $value;
}
示例3: render
/**
* Render minimal price for downloadable products
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
if ($row->getTypeId() == 'downloadable') {
$row->setPrice($row->getPrice());
}
return parent::render($row);
}
示例4: _getFinalPrice
protected function _getFinalPrice($product, $price)
{
$discountedObj = new Varien_Object(array('price' => $price, 'discounted' => false));
Mage::dispatchEvent('affiliateplus_product_get_final_price', array('product' => $product, 'discounted_obj' => $discountedObj));
if ($discountedObj->getDiscounted()) {
return $discountedObj->getPrice();
}
$price = $discountedObj->getPrice();
if ($this->_getConfigHelper()->getGeneralConfig('discount_type') == 'fixed') {
$price -= floatval($this->_getConfigHelper()->getGeneralConfig('discount'));
} elseif ($this->_getConfigHelper()->getGeneralConfig('discount_type') == 'percentage') {
$price -= floatval($this->_getConfigHelper()->getGeneralConfig('discount')) / 100 * $price;
}
if ($price < 0) {
return 0;
}
return $price;
}
示例5: validate
/**
* Validate Product Rule Condition
*
* @param Varien_Object $object
*
* @return bool
*/
public function validate(Varien_Object $object)
{
/** @var Mage_Catalog_Model_Product $product */
$product = $object->getProduct();
if (!$product instanceof Mage_Catalog_Model_Product) {
$product = Mage::getModel('catalog/product')->load($object->getProductId());
}
$product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
return parent::validate($product);
}
示例6: render
/**
* Properly render the price
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
$storeId = $this->getRequest()->getParam('store', 0);
list($base, $currency, $options) = Mage::helper('bronto_product')->currencyAndOptions($storeId);
$price = $row->getPrice();
if ($base != $currency) {
$price = $base->convert($price, $currency, $options);
}
return $currency->formatTxt($price, $options);
}
示例7: validate
/**
* Validate Product Rule Condition
*
* @param Varien_Object $object
*
* @return bool
*/
public function validate(Varien_Object $object)
{
$product = false;
if ($object->getProduct() instanceof Mage_Catalog_Model_Product && $object->getData($this->getAttribute()) !== null) {
$product = $object->getProduct();
} else {
$product = Mage::getModel('catalog/product')->load($object->getProductId());
}
$product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
return parent::validate($product);
}
示例8: render
/**
* Render minimal price for downloadable products
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $row)
{
if ($row->getTypeId() == 'downloadable') {
$row->setPrice($row->getPrice());
}
$Product = Mage::getModel('catalog/product')->load($row->getData('entity_id'));
if (Mage::helper('request4quote')->isRentalInstalled()) {
if ($row->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE || $Product->getIsReservation() != ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_DISABLED) {
$row->setPrice('');
}
}
return parent::render($row);
}
示例9: validate
/**
* Validate Product Rule Condition
*
* @param Varien_Object $object
*
* @return bool
*/
public function validate(Varien_Object $object)
{
/** @var Mage_Catalog_Model_Product $product */
$product = $object->getProduct();
if (!$product instanceof Mage_Catalog_Model_Product) {
$product = Mage::getModel('catalog/product')->load($object->getProductId());
}
$product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
$valid = parent::validate($product);
if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
$children = $object->getChildren();
$valid = $children && $this->validate($children[0]);
}
return $valid;
}
示例10: validate
/**
* Validate Product Rule Condition
*
* @param Varien_Object $object
* @return bool
*/
public function validate(Varien_Object $object)
{
$op = $this->getOperator();
$product = false;
if ($object->getProduct() instanceof Mage_Catalog_Model_Product) {
$product = $object->getProduct();
} else {
$product = Mage::getModel('catalog/product')->load($object->getProductId());
}
$product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
if (!$product->getData($this->getAttribute()) && ($op != '==' || $op != '!=') && $this->getAttribute() != 'category_ids') {
return false;
}
return parent::validate($product);
}
示例11: validate
/**
* Validate Product Rule Condition
*
* @param Varien_Object $object
*
* @return bool
*/
public function validate(Varien_Object $object)
{
/** @var Mage_Catalog_Model_Product $product */
$product = $object->getProduct();
if (!$product instanceof Mage_Catalog_Model_Product) {
$product = Mage::getModel('catalog/product')->load($object->getProductId());
}
$product->setQuoteItemQty($object->getQty())->setQuoteItemPrice($object->getPrice())->setQuoteItemRowTotal($object->getBaseRowTotal());
// Allows attributes to take custom option SKU into consideration
if ($this->getAttribute() === self::QUOTE_ITEM_SKU) {
$product->setData($this->getAttribute(), $object->getSku());
$valid = Mage_Rule_Model_Condition_Product_Abstract::validate($product);
} else {
$valid = parent::validate($object);
}
if (!$valid && $product->getTypeId() == Mage_Catalog_Model_Product_Type_Configurable::TYPE_CODE) {
$children = $object->getChildren();
$valid = $children && $this->validate($children[0]);
}
return $valid;
}
示例12: _formShipmentRequest
/**
* Form array with appropriate structure for shipment request
*
* @param Varien_Object $request
* @return array
*/
protected function _formShipmentRequest(Varien_Object $request)
{
if ($request->getReferenceData()) {
$referenceData = $request->getReferenceData() . $request->getPackageId();
} else {
$referenceData = 'Order #' . $request->getOrderShipment()->getOrder()->getIncrementId() . ' P' . $request->getPackageId();
}
$packageParams = $request->getPackageParams();
$customsValue = $packageParams->getCustomsValue();
$height = $packageParams->getHeight();
$width = $packageParams->getWidth();
$length = $packageParams->getLength();
$weightUnits = $packageParams->getWeightUnits() == Zend_Measure_Weight::POUND ? 'LB' : 'KG';
$dimensionsUnits = $packageParams->getDimensionUnits() == Zend_Measure_Length::INCH ? 'IN' : 'CM';
$unitPrice = 0;
$itemsQty = 0;
$itemsDesc = array();
$countriesOfManufacture = array();
$productIds = array();
$packageItems = $request->getPackageItems();
foreach ($packageItems as $itemShipment) {
$item = new Varien_Object();
$item->setData($itemShipment);
$unitPrice += $item->getPrice();
$itemsQty += $item->getQty();
$itemsDesc[] = $item->getName();
$productIds[] = $item->getProductId();
}
// get countries of manufacture
$productCollection = Mage::getResourceModel('catalog/product_collection')->addStoreFilter($request->getStoreId())->addFieldToFilter('entity_id', array('in' => $productIds))->addAttributeToSelect('country_of_manufacture');
foreach ($productCollection as $product) {
$countriesOfManufacture[] = $product->getCountryOfManufacture();
}
$paymentType = $request->getIsReturn() ? 'RECIPIENT' : 'SENDER';
$requestClient = array('RequestedShipment' => array('ShipTimestamp' => time(), 'DropoffType' => $this->getConfigData('dropoff'), 'PackagingType' => $request->getPackagingType(), 'ServiceType' => $request->getShippingMethod(), 'Shipper' => array('Contact' => array('PersonName' => $request->getShipperContactPersonName(), 'CompanyName' => $request->getShipperContactCompanyName(), 'PhoneNumber' => $request->getShipperContactPhoneNumber()), 'Address' => array('StreetLines' => array($request->getShipperAddressStreet1(), $request->getShipperAddressStreet2()), 'City' => $request->getShipperAddressCity(), 'StateOrProvinceCode' => $request->getShipperAddressStateOrProvinceCode(), 'PostalCode' => $request->getShipperAddressPostalCode(), 'CountryCode' => $request->getShipperAddressCountryCode())), 'Recipient' => array('Contact' => array('PersonName' => $request->getRecipientContactPersonName(), 'CompanyName' => $request->getRecipientContactCompanyName(), 'PhoneNumber' => $request->getRecipientContactPhoneNumber()), 'Address' => array('StreetLines' => array($request->getRecipientAddressStreet1(), $request->getRecipientAddressStreet2()), 'City' => $request->getRecipientAddressCity(), 'StateOrProvinceCode' => $request->getRecipientAddressStateOrProvinceCode(), 'PostalCode' => $request->getRecipientAddressPostalCode(), 'CountryCode' => $request->getRecipientAddressCountryCode(), 'Residential' => (bool) $this->getConfigData('residence_delivery'))), 'ShippingChargesPayment' => array('PaymentType' => $paymentType, 'Payor' => array('AccountNumber' => $this->getConfigData('account'), 'CountryCode' => Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()))), 'LabelSpecification' => array('LabelFormatType' => 'COMMON2D', 'ImageType' => 'PNG', 'LabelStockType' => 'PAPER_8.5X11_TOP_HALF_LABEL'), 'RateRequestTypes' => array('ACCOUNT'), 'PackageCount' => 1, 'RequestedPackageLineItems' => array('SequenceNumber' => '1', 'Weight' => array('Units' => $weightUnits, 'Value' => $request->getPackageWeight()), 'CustomerReferences' => array('CustomerReferenceType' => 'CUSTOMER_REFERENCE', 'Value' => $referenceData), 'SpecialServicesRequested' => array('SpecialServiceTypes' => 'SIGNATURE_OPTION', 'SignatureOptionDetail' => array('OptionType' => $packageParams->getDeliveryConfirmation())))));
// for international shipping
if ($request->getShipperAddressCountryCode() != $request->getRecipientAddressCountryCode()) {
$requestClient['RequestedShipment']['CustomsClearanceDetail'] = array('CustomsValue' => array('Currency' => $request->getBaseCurrencyCode(), 'Amount' => $customsValue), 'DutiesPayment' => array('PaymentType' => $paymentType, 'Payor' => array('AccountNumber' => $this->getConfigData('account'), 'CountryCode' => Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()))), 'Commodities' => array('Weight' => array('Units' => $weightUnits, 'Value' => $request->getPackageWeight()), 'NumberOfPieces' => 1, 'CountryOfManufacture' => implode(',', array_unique($countriesOfManufacture)), 'Description' => implode(', ', $itemsDesc), 'Quantity' => ceil($itemsQty), 'QuantityUnits' => 'pcs', 'UnitPrice' => array('Currency' => $request->getBaseCurrencyCode(), 'Amount' => $unitPrice), 'CustomsValue' => array('Currency' => $request->getBaseCurrencyCode(), 'Amount' => $customsValue)));
}
if ($request->getMasterTrackingId()) {
$requestClient['RequestedShipment']['MasterTrackingId'] = $request->getMasterTrackingId();
}
// set dimensions
if ($length || $width || $height) {
$requestClient['RequestedShipment']['RequestedPackageLineItems']['Dimensions'] = array();
$dimenssions =& $requestClient['RequestedShipment']['RequestedPackageLineItems']['Dimensions'];
$dimenssions['Length'] = $length;
$dimenssions['Width'] = $width;
$dimenssions['Height'] = $height;
$dimenssions['Units'] = $dimensionsUnits;
}
return $this->_getAuthDetails() + $requestClient;
}
示例13: _getInitialItem
/**
* Create and return new order item based on profile item data and $itemInfo
* for initial payment
*
* @param Varien_Object $itemInfo
* @return Mage_Sales_Model_Order_Item
*/
protected function _getInitialItem($itemInfo)
{
$price = $itemInfo->getPrice() ? $itemInfo->getPrice() : $this->getInitAmount();
$shippingAmount = $itemInfo->getShippingAmount() ? $itemInfo->getShippingAmount() : 0;
$taxAmount = $itemInfo->getTaxAmount() ? $itemInfo->getTaxAmount() : 0;
$item = Mage::getModel('sales/order_item')->setStoreId($this->getStoreId())->setProductType(Mage_Catalog_Model_Product_Type::TYPE_VIRTUAL)->setIsVirtual(1)->setSku('initial_fee')->setName(Mage::helper('sales')->__('Recurring Profile Initial Fee'))->setDescription('')->setWeight(0)->setQtyOrdered(1)->setPrice($price)->setOriginalPrice($price)->setBasePrice($price)->setBaseOriginalPrice($price)->setRowTotal($price)->setBaseRowTotal($price)->setTaxAmount($taxAmount)->setShippingAmount($shippingAmount);
$option = array('label' => Mage::helper('sales')->__('Payment type'), 'value' => Mage::helper('sales')->__('Initial period payment'));
$this->_addAdditionalOptionToItem($item, $option);
return $item;
}
示例14: displayPriceInclTax
/**
* Retrieve include tax html formated content
*
* @param Varien_Object $item
* @return string
*/
public function displayPriceInclTax(Varien_Object $item)
{
$qty = $item->getQtyOrdered() ? $item->getQtyOrdered() : ($item->getQty() ? $item->getQty() : 1);
$baseTax = $item->getTaxBeforeDiscount() ? $item->getTaxBeforeDiscount() : ($item->getTaxAmount() ? $item->getTaxAmount() : 0);
$tax = $item->getBaseTaxBeforeDiscount() ? $item->getBaseTaxBeforeDiscount() : ($item->getBaseTaxAmount() ? $item->getBaseTaxAmount() : 0);
$basePriceTax = 0;
$priceTax = 0;
if (floatval($qty)) {
$basePriceTax = $item->getBasePrice() + $baseTax / $qty;
$priceTax = $item->getPrice() + $tax / $qty;
}
return $this->displayPrices($this->getOrder()->getStore()->roundPrice($basePriceTax), $this->getOrder()->getStore()->roundPrice($priceTax));
}
示例15: renderShippingRateOption
/**
* Get shipping rate code title and its price or error message
*
* @param Varien_Object $rate
* @param string $format
* @param string $inclTaxFormat
* @return string
*/
public function renderShippingRateOption($rate, $format = '%s - %s%s', $inclTaxFormat = ' (%s %s)')
{
$renderedInclTax = '';
if ($rate->getErrorMessage()) {
$price = $rate->getErrorMessage();
} else {
$price = $this->_getShippingPrice($rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax());
$incl = $this->_getShippingPrice($rate->getPrice(), true);
if ($incl != $price && $this->helper('tax')->displayShippingBothPrices()) {
$renderedInclTax = sprintf($inclTaxFormat, Mage::helper('tax')->__('Incl. Tax'), $incl);
}
}
return sprintf($format, $this->escapeHtml($rate->getMethodTitle()), $price, $renderedInclTax);
}