News:

Looking for documentation? Take a look on our wiki

Main Menu

$this-> VS $product->

Started by PRO, April 03, 2012, 20:58:22 PM

Previous topic - Next topic

lamcpp

How can I get to "billTotal" field in order_done.php?
I wrote: print_r($this->cart). Result:


VirtueMartCart Object ( [products] => Array ( ) [_inCheckOut] => [_dataValidated] => [_blockConfirm] => [_confirmDone] => [_redirect] => 1 [_redirect_disabled] => [_lastError] => [vendorId] => 1 [lastVisitedCategoryId] => 0 [virtuemart_shipmentmethod_id] => 0 [virtuemart_paymentmethod_id] => 0 [automaticSelectedShipment] => 1 [automaticSelectedPayment] => [BT] => Array ( [email] => tiko35@o2.pl [company] => Test [first_name] => test [last_name] => test [address_1] => ivan [address_2] => test [zip] => 55-333 [city] => test [phone_1] => ) [ST] => 0 [tosAccepted] => [customer_comment] => [couponCode] => [order_language] => [cartData] => Array ( [VatTax] => Array ( ) [duty] => 1 [payment] => 0 [paymentName] => Przy odbiorze [totalProduct] => 1 [DBTaxRulesBill] => Array ( ) [taxRulesBill] => Array ( ) [DATaxRulesBill] => Array ( ) [shipmentName] => Przy odbiorze  [vmVat] => 1 ) [lists] => Array ( [shipTo] => - domyślny (taki sam jak na rachunku)
Shipment
[billTo] => 2 [current_id] => 0 ) [order_number] => [customer_number] => TOfcd7d475a [pricesUnformatted] => Array ( [basePrice] => 75.834 [basePriceWithTax] => 0 [discountedPriceWithoutTax] => 75.834 [salesPrice] => 75.834 [taxAmount] => 0 [salesPriceWithDiscount] => 0 [discountAmount] => 0 [priceWithoutTax] => 75.834 [subTotalProducts] => 0 [23] => Array ( [costPrice] => 75.83400 [basePrice] => 75.834 [basePriceVariant] => 75.834 [basePriceWithTax] => 0 [discountedPriceWithoutTax] => 75.834 [priceBeforeTax] => 75.834 [salesPrice] => 75.834 [taxAmount] => 0 [salesPriceWithDiscount] => 0 [salesPriceTemp] => 75.834 [unitPrice] => 0 [discountAmount] => -0 [priceWithoutTax] => 75.834 [variantModification] => 0 [DBTax] => Array ( ) [Tax] => Array ( ) [VatTax] => Array ( ) [DATax] => Array ( ) [subtotal_with_tax] => 75.834 [subtotal_tax_amount] => 0 [subtotal_discount] => 0 [subtotal] => 75.834 ) [salesPriceDBT] => Array ( ) [taxRulesBill] => Array ( ) [DATaxRulesBill] => Array ( ) [shipmentValue] => 20 [shipmentTax] => 0 [salesPriceShipment] => 20 [shipment_calc_id] => 0 [cost] => 0 [salesPriceCoupon] => 0 [withTax] => 75.834 [paymentValue] => 0 [paymentTax] => 0 [paymentTotal] => 0 [salesPricePayment] => 0 [payment_calc_id] => 0 [billSub] => 95.834 [billDiscountAmount] => 0 [billTaxAmount] => 0 [billTotal] => 95.834 ) [pricesCurrency] => 114 [paymentCurrency] => 114 [STsameAsBT] => 1 [productParentOrderable] => 1 [_triesValidateCoupon] => Array ( ) [useSSL] => 0 [useXHTML] => [virtuemart_order_id] => 74 )


I try showing value of "billTotal" field. I write: echo $this->cart->billTotal; but this doesn't work. Why?

mfarooqi

Quote from: PRO on November 28, 2012, 19:08:03 PM
Quote from: k0walsky on November 28, 2012, 12:31:48 PM
hello if you want to hide the first picture below on additional image

   foreach ($product->images as $image)
   {   
   if (($product->images[0]->file_url_thumb) == ($image->file_url_thumb))
      {} else {
       echo '<div class="floatleft">' . $image->displayMediaThumb('class="product-image-small"', true, 'class="modal"', true, true);
      echo '</div>';}
   }


if (($product->images[0]->file_url_thumb) == ($image->file_url_thumb))
      {continue;}



Thank you very much :)

AntonioS28

Hi sorry if i use this old post but i'm making some modifies on padded.php file of virtuemart 3!
My code is this, and i NEED to add the image of the product i added in the cart
<?php
/**
*
* Layout for the add to cart popup
*
* @package VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2013 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: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

echo 
'<a class="continue_link" href="' $this->continue_link '" >' vmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo 
'<a class="showcart floatright" href="' $this->cart_link '">' vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
if(
$this->products){
foreach($this->products as $product){
if($product->quantity>0){
echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity).'</h4>'
[
size=24pt]-------> NEED TO ADD THE IMAGE OF THE PRODUCT HERE <--------------[/size]
} else {
if(!empty($product->errorMsg)){
echo '<div>'.$product->errorMsg.'</div>';
}
}

}
}


if(
VmConfig::get('popup_rel',1)){
//VmConfig::$echoDebug=true;
if ($this->products and is_array($this->products) and count($this->products)>) {

$product reset($this->products);

$customFieldsModel VmModel::getModel('customfields');
$product->customfields $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds,'R');

$customFieldsModel->displayProductCustomfieldFE($product,$product->customfields);
if(!empty($product->customfields)){
?>

<div class="product-related-products">
<h4><?php echo vmText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>
<?php
}
foreach($product->customfields as $rFields){

if(!empty($rFields->display)){
?>
<div class="product-field product-field-type-<?php echo $rFields->field_type ?>">
<div class="product-field-display"><?php echo $rFields->display ?></div>
</div>
<?php }
?>

</div>
<?php
}
}

?>

<br style="clear:both">
<p style="background: #9eb618; border-radius:9px; font-weight:600; padding:"> SPEDIZIONE GRATUITA PER ORDINI SUPERIORI A 70€ !</p>

GJC Web Design

$product->images[0]->file_url  (url)

or perhaps

echo $product->images[0]->displayMediaFull("id='main-image'",true,"rel='vm-additional-images'");

for the full html
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

PRO

echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);

AntonioS28

i tried the three proposal but no one works!
The popup does not appear with your codes!

GJC Web Design

wrong file?

echo out $product

print 'Debug Line '.__LINE__.' $product <pre>'; print_r ($product); print "</pre><br />\n";
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AntonioS28

no the file is correct,
now appear
[virtuemart_product_id] => 6
    [virtuemart_vendor_id] => 1
    [product_parent_id] => 0
    [product_sku] =>
    [product_gtin] =>
    [product_mpn] =>
    [product_name] => prova2
    [slug] => prova-2-4-5
    [product_s_desc] =>
    [product_desc] =>
    [product_weight] =>
    [product_weight_uom] => KG
    [product_length] =>
    [product_width] =>
    [product_height] =>
    [product_lwh_uom] => M
    [product_url] =>
    [product_in_stock] => 100
    [product_ordered] => 1

no one remind the product image!

GJC Web Design

Ah .. the image object isn't passed to this view

perhaps

$productModel = VmModel::getModel('product');
$productModel->addImages($this->products, 1);

before the if loop?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

avisbag

Virtuemart 2.6.22

I'm trying to put a script into my product details template. The code was given except the variable I needed to replace with product id (whatever I am referring to the product by in ShopperApproved). I've tried the following and it doesn't seem to be working. Also not quite sure if I put it in the right spot, but I put it in the div that holds the short description and such.


<script type="text/javascript"> var sa_products_count = 3; var sa_date_format = 'F j, Y'; var sa_product = '<?php echo $this->product->product_sku?>'; function saLoadScript(src) { var js = window.document.createElement("script"); js.src = src; js.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(js); } saLoadScript('//www.shopperapproved.com/product/20541/'+sa_product+'.js'); </script><div id="review_header"></div><div id="product_page"></div><div id="review_image"><a href="www.shopperapproved.com/reviews/Avisbag.com/" target="_blank" rel="nofollow"></a></div>

GJC Web Design

is it referred by sku?

or id? id is $this->product->virtuemart_product_id

what doesn't work?
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

avisbag

Sku. Their placeholder was [Product ID], which I replaced.

Can I basically put this anywhere on the page? Inside of the php tags?

GJC Web Design

yes.. the $this is available throughout the view
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

rebelhn

How can i get products by category id in VM 3.0.14? I changed code from sublayout of categories to show all products
$products = $productModel->getProductsInCategory($category_id); but nothing happen