News:

Looking for documentation? Take a look on our wiki

Main Menu

Problem show price in product details

Started by petepeith, June 12, 2012, 16:57:03 PM

Previous topic - Next topic

petepeith

Price: <?php echo $this->loadTemplate('showprices'); ?>

I want it to show in the same line like this
Price: 999 $

but I get this result
Price:
999 $

any solution?


srajca

go to templates/YOURTEMPLATE/html/com_virtuemart/productdetails/default_showprices.php
and modify your code
I just commented out a couple
<?php
    
}
    if (
$this->showBasePrice) {
//komentiral jaz echo $this->currency->createPriceDiv('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
//komentiral jaz echo $this->currency->createPriceDiv('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
    
}

    echo 
$this->currency->createPriceDiv('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);
    echo 
"<strong>" .  $this->currency->createPriceDiv('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$this->product->prices) . "</strong>";

    
//echo $this->currency->createPriceDiv('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices);
    
echo $this->currency->createPriceDiv('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);
    //echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
    
echo $this->currency->createPriceDiv('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
    
?>

</div>

and make sure you have selected base price and others in virtuemart configuration - both price and label.
Hope it helps

petepeith

Quote from: srajca on June 12, 2012, 17:17:30 PM
go to templates/YOURTEMPLATE/html/com_virtuemart/productdetails/default_showprices.php
and modify your code
I just commented out a couple
<?php
    
}
    if (
$this->showBasePrice) {
//komentiral jaz echo $this->currency->createPriceDiv('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
//komentiral jaz echo $this->currency->createPriceDiv('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
    
}

    echo 
$this->currency->createPriceDiv('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);
    echo 
"<strong>" .  $this->currency->createPriceDiv('basePriceWithTax''COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX'$this->product->prices) . "</strong>";

    
//echo $this->currency->createPriceDiv('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices);
    
echo $this->currency->createPriceDiv('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);
    //echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
    
echo $this->currency->createPriceDiv('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
    
?>

</div>

and make sure you have selected base price and others in virtuemart configuration - both price and label.
Hope it helps

still doesn't work for me  :'(

srajca

do you have the prices marked in virtuemart configuration? Also check that code again and go through the comments I've made, since I adapted it to my needs.
If you want what you stated in the first post then try using this code<?php
    
}
    if (
$this->showBasePrice) {
//komentiral jaz echo $this->currency->createPriceDiv('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
//komentiral jaz echo $this->currency->createPriceDiv('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
    
}

    echo 
$this->currency->createPriceDiv('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);
    
//echo "<strong>" .  $this->currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</strong>";

    //echo $this->currency->createPriceDiv('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices);
    
echo $this->currency->createPriceDiv('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);
    echo 
$this->currency->createPriceDiv('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices);
    
//echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
    
echo $this->currency->createPriceDiv('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
    
?>

</div>

and make sure that in virtuemart configuration you have checked sales price and base price...let me know if it works.

petepeith

Quote from: srajca on June 13, 2012, 09:36:34 AM
do you have the prices marked in virtuemart configuration? Also check that code again and go through the comments I've made, since I adapted it to my needs.
If you want what you stated in the first post then try using this code<?php
    
}
    if (
$this->showBasePrice) {
//komentiral jaz echo $this->currency->createPriceDiv('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);
//komentiral jaz echo $this->currency->createPriceDiv('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
    
}

    echo 
$this->currency->createPriceDiv('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);
    
//echo "<strong>" .  $this->currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices) . "</strong>";

    //echo $this->currency->createPriceDiv('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices);
    
echo $this->currency->createPriceDiv('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);
    echo 
$this->currency->createPriceDiv('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices);
    
//echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
    
echo $this->currency->createPriceDiv('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);
    
//echo $this->currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
    
?>

</div>

and make sure that in virtuemart configuration you have checked sales price and base price...let me know if it works.

I've tried and got this result
Price:
Sales price: $ 2000
Discount: $ 400

I just want it to move the price up to the same line
Price: Sales price: $ 2000, Discount: $ 400
But it seem to be difficult  :-[

srajca

Try changing your whole showprice.php file with the code below.
<?php
/**
 *
 * Show the product details page
 *
 * @package VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen

 * @link http://www.virtuemart.net
 * @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * VirtueMart is free software. This version may have been modified pursuant
 * to the GNU General Public License, and as distributed it includes or
 * is derivative of works licensed under the GNU General Public License or
 * other free or open source software licenses.
 * @version $Id: default_showprices.php 5834 2012-04-09 12:05:33Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

?>

<div class="product-price" id="productPrice<?php echo $this->product->virtuemart_product_id ?>">
    <?php
/* 
    if ($this->product->product_unit && VmConfig::get('price_show_packaging_pricelabel')) {
echo "<strong>" . JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT') . ' (' . $this->product->product_unit . "):</strong>";
    } else {
echo "<strong>" . JText::_('COM_VIRTUEMART_CART_PRICE') . "</strong>";
    }
*/
    
if (empty($this->product->prices) and VmConfig::get('askprice'1)) {
?>

        <a class="ask-a-question bold" href="<?php echo $url ?>" ><?php echo JText::_('COM_VIRTUEMART_PRODUCT_ASKPRICE'?></a>
    <?php
    
}
    if (
$this->showBasePrice) {
        echo 
$this->currency->createPriceDiv('basePrice''COM_VIRTUEMART_PRODUCT_BASEPRICE'$this->product->prices);
//komentiral jaz echo $this->currency->createPriceDiv('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $this->product->prices);
    
}

    echo 
$this->currency->createPriceDiv('variantModification''COM_VIRTUEMART_PRODUCT_VARIANT_MOD'$this->product->prices);
    
//echo $this->currency->createPriceDiv('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $this->product->prices);

    //echo $this->currency->createPriceDiv('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE', $this->product->prices);
    
echo $this->currency->createPriceDiv('salesPriceWithDiscount''COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT'$this->product->prices);
    echo 
$this->currency->createPriceDiv('salesPrice''COM_VIRTUEMART_PRODUCT_SALESPRICE'$this->product->prices);
   
//echo $this->currency->createPriceDiv('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $this->product->prices);
    
echo $this->currency->createPriceDiv('discountAmount''COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT'$this->product->prices);
    
//komentiral jaz echo $this->currency->createPriceDiv('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $this->product->prices);
    
?>

</div>

This should give you the following output;
Price: XXX$
Sales Price: xxx$
Discount:xxx$

If you want to remove Price or sales price just put two forward slashes in front of
echo $this->currency->createPriceDiv('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $this->product->prices);   ----> for sales price
echo $this->currency->createPriceDiv('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $this->product->prices);     ----> for base price
Let me know if this now works.