News:

Looking for documentation? Take a look on our wiki

Main Menu

Cart Page Fields & Modifications

Started by PRO, August 15, 2012, 15:10:06 PM

Previous topic - Next topic

jzdana

Many thanks for your useful topic. I would like to show category path of product as a separated field right before product name in price list on the cart page. The problem is that the fields in loop(foreach) are called from table of 'products' in Database. How can I solve it? any help would be appreciated.

jzdana

#91
No one has any idea?!

PRO

Quote from: jzdana on October 29, 2013, 10:20:16 AM
Many thanks for your useful topic. I would like to show category path of product as a separated field right before product name in price list on the cart page. The problem is that the fields in loop(foreach) are called from table of 'products' in Database. How can I solve it? any help would be appreciated.
I dont know about category path,
but category name & id could easily be done. It's in the array.

Atleast I know the category id is.

nhinzky

#93
Hi Guys,

I want to know how can I get the fields in shipping address from this line of code(below) from the edit_address_addshipto.php under this directory (/public_html/components/com_virtuemart/views/user/tmpl):

<?php echo $this->lists['shipTo'];

I want to get the how can I display the first_name, last_name, and etc instead of displaying it using the above code. Can you help me guys?

EDIT: This post also refers to the same issue : http://forum.virtuemart.net/index.php?topic=119904.msg408199#msg408199

Thank you.

Stonedfury

No such thing as a stupid question, only a stupid answer. I won't ask if I know the answer or found it using the search as you suggested.

jzdana

QuoteI dont know about category path,
but category name & id could easily be done. It's in the array.

Atleast I know the category id is.

I would appreciate if you guide me how to show category name in the price list based on category id. I have tested some lines but without success.

siristru

Good topic. Let me share with you my method. Virtuemart 2 has solution already :D but you need to modify it a bit. So here is what you need:

4 php files from components/com_virtuemart/views/cart/tmpl

default.php
default_pricelist.php
select_payment.php
select_shipment.php

1 file from components/com_virtuemart/views/user/tmpl

edit_address.php

Copy them to templates/[your_template]/html/com_virtuemart/cart

And now lets start. File "default.php" shows shopping cart at start and at the end of ordering process. So find this lines:

<?php if (VmConfig::get ('oncheckout_show_steps'1) && $this->checkout_task === 'confirm') {
vmdebug ('checkout_task'$this->checkout_task);
echo '<div class="checkoutStep" id="checkoutStep4">' JText::('COM_VIRTUEMART_USER_FORM_CART_STEP4') . '</div>';
?>


Should be around 90 line.

As you can see it displays "checkoutStep4" that contains info about last, 4th step of order. Now lets change it a bit:

<?php if (VmConfig::get ('oncheckout_show_steps'1) && $this->checkout_task === 'confirm') {
vmdebug ('checkout_task'$this->checkout_task);
echo 'Here is step 4 so add html code with steps in div's with images that should be displayed on the end';
} else {
echo '
Here is step 1 so add html code with steps in div's with images that should be displayed on the beginning';
}
?>


You can add whatever you want and style it in your css.

Next thing is to handle 2nd step. In my case it's login/registration page.

We need to edit edit_address.php file. Copy it to templates/[your_template]/html/com_virtuemart/user.
In this file look for line:

<h1><?php echo $this->page_title ?></h1>

Now ad after it (or in any other suitable for you) place;

<?php if (empty($this->cart->BT)){ ?>
Here is step 2 so add html code with steps in div's with images that should be displayed on the 2nd step
<?php }?>


I used in this case PRO's solution - thanks!

Ok, now you need to modify select_shipment.php
Look for this code:

if (VmConfig::get('oncheckout_show_steps', 1)) {
echo '<div class="checkoutStep" id="checkoutStep2">' . JText::_('COM_VIRTUEMART_USER_FORM_CART_STEP2') . '</div>';
}


And modify it to


if (VmConfig::get('oncheckout_show_steps', 1)) {
echo 'Here is step 3 so add html code with steps in div's with images that should be displayed on the 3nd step';
}


Now modify file select_payment.php in this line:

if (VmConfig::get('oncheckout_show_steps', 1)) {
    echo '<div class="checkoutStep" id="checkoutStep3">' . JText::_('COM_VIRTUEMART_USER_FORM_CART_STEP3') . '</div>';
}


Change it to:

if (VmConfig::get('oncheckout_show_steps', 1)) {
    echo 'Here is step 3 so add html code with steps in div's with images that should be displayed on the 3nd step';
}


My 5th step is confirmation of an order so we return to file default.php and apply changes just as I mentioned on beginning.

With bit of css styling it can look like mine:







Life example is here: http://kamizelkiodblaskowe.com.pl/koszyk.html (Shop is only in Polish, sorry ;) )

I attach my php files, icons and css style. I'm sure that you can do it much better than I ;) All you need is individual styling in css. I hope that I helped a bit ;)

[attachment cleanup by admin]
Само слога Славjанa спашава - Свуда пођи, својој кући дођи.

viperz

I Insert
<?php if (empty($this->cart->BT)){ ?> What you put here will be shown when NO billing address is completed<?php }?>

<?php if (!empty($this->cart->BT)){ ?> This shows AFTER the billing Address is completed <?php }?>

into my default.php (views/cart).


But it allways show "This shows AFTER the billing Address is completed " even if no address was filled.
After filling the Billing adress it show "This shows AFTER the billing Address is completed "  again.


Sorry for my bad english... can somebody help me?

V 2.0

PRO

Quote from: viperz on January 29, 2014, 11:09:55 AM
I Insert
<?php if (empty($this->cart->BT)){ ?> What you put here will be shown when NO billing address is completed<?php }?>

<?php if (!empty($this->cart->BT)){ ?> This shows AFTER the billing Address is completed <?php }?>

into my default.php (views/cart).


But it allways show "This shows AFTER the billing Address is completed " even if no address was filled.
After filling the Billing adress it show "This shows AFTER the billing Address is completed "  again.


Sorry for my bad english... can somebody help me?

V 2.0



See the first post. at the bottom after "I was getting problems with checking for billing address when default country is set."
http://forum.virtuemart.net/index.php?topic=106459.0

Mole_LR

Hi!

How it's possible to "call" CustomField price into cart (so, instead of 1 Subtotal (ProductPrice), it could show:
ProductPrice: X
CustomFieldvalueprice (priceVariant): Y
Discounts...Taxes...etc...
Total: X + Y

?

Thank You!

J3DI13

Hi There

How would i replace the 'Tax' & 'Discount' columns in the cart and replace it to uptput the 'cost ex vat' and 'vat'. As demonstrated in the image attached.

Your help would be greatly appreciated!

[attachment cleanup by admin]

J3DI13

Is there really no way of doing this?

AH

Yes it is possible

You have to create a template override to the

Something like this for the headers


<tr>
<th align="left"><?php echo JText::('COM_VIRTUEMART_CART_NAME'?></th>
<th align="left"width="110px"><?php echo JText::('COM_VIRTUEMART_CART_SKU'?></th>
<th align="center" width="60px"><?php echo JText::('COM_VIRTUEMART_CART_PRICE'?></th>
<th align="center" width="90px"><?php echo JText::('COM_VIRTUEMART_CART_QUANTITY'?></th>
<?php if (VmConfig::get ('show_tax')) { ?>
<th align="center"><?php  echo "<span  class='priceColor2'>" JText::('COM_VIRTUEMART_CART_SUBTOTAL_TAX_AMOUNT') . '</span>' ?></th>
<?php ?>
<th align="center"><?php echo "<span  class='priceColor2'>" JText::('COM_VIRTUEMART_CART_SUBTOTAL_NET_AMOUNT') . '</span>' ?></th>
<th align="center"><?php echo JText::('COM_VIRTUEMART_CART_TOTAL'?></th>
</tr>



Then adjust your detail row


<td align="left" style="font-size:10px;"><?php  echo $prow->product_sku ?></td>
<td align="center">
<?php
// quorvia removed for clarity
// if (VmConfig::get ('checkout_show_origprice', 1) && $this->cart->pricesUnformatted[$pkey]['discountedPriceWithoutTax'] != $this->cart->pricesUnformatted[$pkey]['priceWithoutTax']) {
// echo '<span class="line-through">' . $this->currencyDisplay->createPriceDiv ('basePriceVariant', '', $this->cart->pricesUnformatted[$pkey], TRUE, FALSE) . '</span><br />';
// }
if ($this->cart->pricesUnformatted[$pkey]['discountedPriceWithoutTax']) {
echo $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE);
} else {
echo $this->currencyDisplay->createPriceDiv ('basePriceVariant'''$this->cart->pricesUnformatted[$pkey], FALSEFALSE);
}
//  echo $prow->salesPrice ;
?>

</td>



And then your subtotal line needs some tax

<tr class="cart-subtotal">
<td colspan="4" align="right"><?php echo JText::('COM_VIRTUEMART_ORDER_PRINT_PRODUCT_PRICES_TOTAL'); ?></td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('taxAmount'''$this->cart->pricesUnformattedFALSE) . "</span>" ?></td>
<?php ?>
<td align="right"><?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('discountedPriceWithoutTax'''$this->cart->pricesUnformattedFALSE) . "</span>" ?></td>
<td align="right"><?php echo                                 $this->currencyDisplay->createPriceDiv ('salesPrice'''$this->cart->pricesUnformattedFALSE?></td>
</tr>



And then you will want to have a total tax, which is not included in any variables and I just think that this was not considered by the Dev's to be useful, as all our customers love to calculate their own values  :o !


<tr class="cart-totals">
<td colspan="4"><?php echo JText::('COM_VIRTUEMART_CART_TOTAL'?></td>

<?php if (VmConfig::get ('show_tax')) { ?>
<td> <?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('billTaxAmount'''$this->cart->pricesUnformatted['billTaxAmount'], FALSE) . "</span>" ?> </td>
<?php }
    
//quorvia has to create a net amount for the cart
    
$billNet $this->cart->pricesUnformatted['billTotal'] - $this->cart->pricesUnformatted['billTaxAmount']; //quorvia new
    
?>


    <td> <?php echo "<span  class='priceColor2'>" $this->currencyDisplay->createPriceDiv ('billNet'''$billNet FALSE) . "</span>" ?> </td>
<td><div class="bold"><?php echo $this->currencyDisplay->createPriceDiv ('billTotal'''$this->cart->pricesUnformatted['billTotal'], FALSE); ?></div></td>
</tr>[code]

[/code]


This might not be the exact format, but should get you started along the right path
Regards
A

Joomla 4.4.5
php 8.1

J3DI13

Thank you so much Hutson, the first bit of positive ive had for this issue. I will give it bash now, will let you know.

Again Thank You!

AH

Regards
A

Joomla 4.4.5
php 8.1