Author Topic: $this-> VS $product->  (Read 43242 times)

lamcpp

  • Beginner
  • *
  • Posts: 9
  • Skype Name: tdfdf
Re: $this-> VS $product->
« Reply #30 on: February 07, 2014, 15:42:46 pm »
How can I get to "billTotal" field in order_done.php?
I wrote: print_r($this->cart). Result:
Code: [Select]

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

  • Beginner
  • *
  • Posts: 32
Re: $this-> VS $product->
« Reply #31 on: February 11, 2014, 17:28:11 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

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: $this-> VS $product->
« Reply #32 on: December 18, 2015, 18:04:09 pm »
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
Code: [Select]
<?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

  • 3rd party VirtueMart Developer
  • Hero Member
  • *
  • Posts: 7485
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: $this-> VS $product->
« Reply #33 on: December 18, 2015, 18:12:50 pm »
$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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10270
  • VirtueMart Version: 3+
Re: $this-> VS $product->
« Reply #34 on: December 18, 2015, 18:19:01 pm »
echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
I do NOT do development work for hire.

AntonioS28

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: $this-> VS $product->
« Reply #35 on: December 18, 2015, 20:20:34 pm »
i tried the three proposal but no one works!
The popup does not appear with your codes!

GJC Web Design

  • 3rd party VirtueMart Developer
  • Hero Member
  • *
  • Posts: 7485
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: $this-> VS $product->
« Reply #36 on: December 18, 2015, 20:26:45 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

AntonioS28

  • Beginner
  • *
  • Posts: 6
  • A beginner
Re: $this-> VS $product->
« Reply #37 on: December 18, 2015, 20:36:27 pm »
no the file is correct,
now appear
Code: [Select]
[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

  • 3rd party VirtueMart Developer
  • Hero Member
  • *
  • Posts: 7485
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: $this-> VS $product->
« Reply #38 on: December 18, 2015, 22:24:15 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

avisbag

  • Beginner
  • *
  • Posts: 4
Re: $this-> VS $product->
« Reply #39 on: January 21, 2016, 20:02:22 pm »
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.

Code: [Select]
<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

  • 3rd party VirtueMart Developer
  • Hero Member
  • *
  • Posts: 7485
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: $this-> VS $product->
« Reply #40 on: January 21, 2016, 23:12:51 pm »
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 http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

avisbag

  • Beginner
  • *
  • Posts: 4
Re: $this-> VS $product->
« Reply #41 on: January 21, 2016, 23:54:30 pm »
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

  • 3rd party VirtueMart Developer
  • Hero Member
  • *
  • Posts: 7485
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.2
Re: $this-> VS $product->
« Reply #42 on: January 22, 2016, 00:13:28 am »
yes.. the $this is available throughout the view
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

rebelhn

  • Beginner
  • *
  • Posts: 8
  • A beginner
Re: $this-> VS $product->
« Reply #43 on: May 10, 2016, 07:44:32 am »
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