VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: Ygorfk on January 05, 2020, 20:16:51 PM

Title: Dividing payments of creditcard
Post by: Ygorfk on January 05, 2020, 20:16:51 PM
"Hi, i would like to add support in my shop to credit card payments with divided payments method but i can't find it in the existing modules list.

anyone have any idea about it?"

I found this topic with the same question I have, but it got no answer, so I'm giving the topic a UP.
http://forum.virtuemart.net/index.php?topic=47720.msg152926#msg152926

My versions
VirtueMart 3.6.10 10211
Joomla! 3.9.14 Stable
Title: Re: Dividing payments of creditcard
Post by: Studio 42 on January 05, 2020, 22:08:26 PM
You can manually add the display and use a paiement that can handle it as paypal for eg.
Title: Re: Dividing payments of creditcard
Post by: Ygorfk on January 06, 2020, 01:01:52 AM
So I tried to add, but I couldn't, can you submit a tutorial on how to add? I would appreciate it very much. =)
Title: Re: Dividing payments of creditcard
Post by: Ygorfk on January 22, 2020, 14:00:16 PM
Hello good Morning.

Is there a way to display the current product price in a custom field? if you have how to do that I think the code to do this division of the value would be possible, so the question is;

Is it possible to show the value of the product in a custom field?
Title: Re: Dividing payments of creditcard
Post by: Studio 42 on January 22, 2020, 17:40:35 PM
You need to add it using PHP at the position you want else you need each time to update manually the price in the customfield.
Title: Re: Dividing payments of creditcard
Post by: Ygorfk on January 23, 2020, 01:55:36 AM
Okay, but do you know the code to display the product price so I can add PHP?

It would be something like:

$valor_produto = "320.80"; //texto
$total_parcelas = 2; //numero

$valor_parcelado = floatval($valor_produto) / 2;

echo $valor_parcelado;
Title: Re: Dividing payments of creditcard
Post by: Studio 42 on January 24, 2020, 02:19:41 AM
Check the price sublayout
YOURSITE/components/com_virtuemart/sublayouts/prices.php
Get the price you need and apply the division.
Title: Re: Dividing payments of creditcard
Post by: Ygorfk on January 25, 2020, 22:50:18 PM
Hello again, I have no knowledge of PHP, but I know that I just need to add the right variable, does anyone know what the variable is?
In line 100 and 101 is the code I added, but the variable is like "????" why I don't know what the variable is.

I don't know the size of the variable ... I need help


<?php
/**
 *
 * Show the product prices
 *
 * @package    VirtueMart
 * @subpackage
 * @author Max Milbers, Valerie Isaksen
 * @link https://virtuemart.net
 * @copyright Copyright (c) 2004 - 2014 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 8024 2014-06-12 15:08:59Z Milbo $
 */
// Check to ensure this file is included in Joomla!
defined ('_JEXEC') or die('Restricted access');
$product = $viewData['product'];
$currency = $viewData['currency'];

?>

<div class="product-price" id="productPrice<?php echo $product->virtuemart_product_id ?>" data-vm="product-prices">
<?php
if (!empty(
$product->prices['salesPrice'])) {
//echo '<div class="vm-cart-price">' . vmText::_ ('COM_VIRTUEMART_CART_PRICE') . '</div>';
}

if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and isset($product->images[0]) and !$product->images[0]->file_is_downloadable) {
$askquestion_url = JRoute::_('index.php?option=com_virtuemart&view=productdetails&task=askquestion&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id . '&tmpl=component', FALSE);
?>

<a class="ask-a-question bold" href="<?php echo $askquestion_url ?>" rel="nofollow" ><?php echo vmText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE') ?></a>
<?php
} else {
//if ($showBasePrice) {
echo $currency->createPriceDiv ('basePrice', 'COM_VIRTUEMART_PRODUCT_BASEPRICE', $product->prices);
//if (round($product->prices['basePrice'],$currency->_priceConfig['basePriceVariant'][1]) != $product->prices['basePriceVariant']) {
echo $currency->createPriceDiv ('basePriceVariant', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT', $product->prices);
//}

//}
echo $currency->createPriceDiv ('variantModification', 'COM_VIRTUEMART_PRODUCT_VARIANT_MOD', $product->prices);
if (round($product->prices['basePriceWithTax'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
echo '<span class="price-crossed" >' . $currency->createPriceDiv ('basePriceWithTax', 'COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX', $product->prices) . "</span>";
}
if (round($product->prices['salesPriceWithDiscount'],$currency->_priceConfig['salesPrice'][1]) != round($product->prices['salesPrice'],$currency->_priceConfig['salesPrice'][1])) {
echo $currency->createPriceDiv ('salesPriceWithDiscount', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT', $product->prices);
}

echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
echo $currency->createPriceDiv ('salesPriceTt', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_TT', $product->prices);
$infotax = vmConfig::get('vm_prices_info_tax', 0);
$infodelivery = vmConfig::get('vm_prices_info_delivery', 0);
if ($infotax == 1 or $infodelivery == 1) { ?>

<div class="vm-prices-info">



<?php
if ($infotax == 1) {
if ($product->prices['priceWithoutTax'] == $product->prices['salesPrice']) {
$taxclusive = 'COM_VM_TAX_EXCLUSIVE';
} else {
$taxclusive = 'COM_VM_TAX_INCLUSIVE';
}
echo vmText::_($taxclusive);
}
if ($infotax == 1 and $infodelivery == 1) {
echo vmText::_('COM_VM_PRICES_INFO_DIVIDER');
}
if ($infodelivery == 1) {
echo vmText::_('COM_VM_PRICES_INFO_DELIVERY');
} ?>

</div>



<?php
}

//echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
//echo $currency->createPriceDiv ('salesPriceQu', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
if ($product->prices['discountedPriceWithoutTax'] != $product->prices['priceWithoutTax']) {
echo $currency->createPriceDiv ('discountedPriceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
echo $currency->createPriceDiv ('discountedPriceWithoutTaxTt', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX_TT', $product->prices);
} else {
echo $currency->createPriceDiv ('priceWithoutTax', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX', $product->prices);
echo $currency->createPriceDiv ('priceWithoutTaxTt', 'COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX_TT', $product->prices);
}
echo $currency->createPriceDiv ('discountAmount', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT', $product->prices);
echo $currency->createPriceDiv ('discountAmountTt', 'COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT_TT', $product->prices);
echo $currency->createPriceDiv ('taxAmount', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT', $product->prices);
echo $currency->createPriceDiv ('taxAmountTt', 'COM_VIRTUEMART_PRODUCT_TAX_AMOUNT_TT', $product->prices);
$unitPriceDescription = vmText::sprintf ('COM_VIRTUEMART_PRODUCT_UNITPRICE', vmText::_('COM_VIRTUEMART_UNIT_SYMBOL_'.strtoupper($product->product_unit)));
echo $currency->createPriceDiv ('unitPrice', $unitPriceDescription, $product->prices);
}


$valor_parcelado = floatval($????) / 2;
echo 
$valor_parcelado;

?>

</div>
Title: Re: Dividing payments of creditcard
Post by: GJC Web Design on January 25, 2020, 23:47:43 PM
$product->prices['salesPrice']
Title: Re: Dividing payments of creditcard
Post by: Studio 42 on January 25, 2020, 23:52:32 PM
Check in your config the price dispalyed you want /2
$product->prices have all existing price you can use.
Try for eg.
var_dump($product->prices);
Or print_r
salesPrice is the final price including taxes + discounts ....