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

Stonedfury

  • Jr. Member
  • **
  • Posts: 267
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: $this-> VS $product->
« Reply #15 on: May 13, 2013, 02:52:16 am »
How can I load the current product into a module? I tried
Code: [Select]
<?php echo $this->product->product_name ?> I get no error but I get no module text either. The module shows the title shows but it just doesn't load a product name. :(
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.

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10278
  • VirtueMart Version: 3+
Re: $this-> VS $product->
« Reply #16 on: May 13, 2013, 11:03:23 am »
How can I load the current product into a module? I tried
Code: [Select]
<?php echo $this->product->product_name ?> I get no error but I get no module text either. The module shows the title shows but it just doesn't load a product name. :(


yopu cant without custom coding


what exactly do you want to do?

I do NOT do development work for hire.

Stonedfury

  • Jr. Member
  • **
  • Posts: 267
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: $this-> VS $product->
« Reply #17 on: May 13, 2013, 17:50:25 pm »
I purchased a very crappy module that loads recently purchased products. I have been trying to clean it up and make it load better. I could truly use some help. I don't want to commandeer this post though. I was just checking to make sure I wasn't totally stupid. lol Ill start a new topic.
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.

antonino78

  • Jr. Member
  • **
  • Posts: 130
Re: $this-> VS $product->
« Reply #18 on: June 29, 2013, 15:38:40 pm »
Hello,
I would show you a picture in the category when a product is not available.
I would use something like this:
Code: [Select]
<div style="padding:5px;">
<a><?php if ($this->product->product_in_stock == 0) {echo "<img src='http://mysite/images/red2.png' non disponibile' onclick=\"javascript:window.open('/legenda.html','legenda',')\"";} 
                
?>
</a>
</div>
I used this product in detail and it worked out great in the category but I do not know how to do.
can anyone help me please?  :'(

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10278
  • VirtueMart Version: 3+
Re: $this-> VS $product->
« Reply #19 on: June 29, 2013, 16:48:47 pm »
Hello,
I would show you a picture in the category when a product is not available.
I would use something like this:
Code: [Select]
<div style="padding:5px;">
<a><?php if ($this->product->product_in_stock == 0) {echo "<img src='http://mysite/images/red2.png' non disponibile' onclick=\"javascript:window.open('/legenda.html','legenda',')\"";} 
                
?>
</a>
</div>
I used this product in detail and it worked out great in the category but I do not know how to do.
can anyone help me please?  :'(


did you NOT read the first POST in this thread?

$this->    or    $product->

There is a place foreach one
I do NOT do development work for hire.

antonino78

  • Jr. Member
  • **
  • Posts: 130
Re: $this-> VS $product->
« Reply #20 on: June 29, 2013, 17:26:01 pm »
Hello,
thanks for your answers.
Since I'm no expert I would be grateful if you could post the solution without sending me to other posts.
The code that I posted it found around ilo web and it worked perfectly for product details.
I simply would like to know how should I modify it to make it work aqnche products in the category.
Can you help me please? :-[

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10278
  • VirtueMart Version: 3+
Re: $this-> VS $product->
« Reply #21 on: June 29, 2013, 20:28:01 pm »
Hello,
thanks for your answers.
Since I'm no expert I would be grateful if you could post the solution without sending me to other posts.
The code that I posted it found around ilo web and it worked perfectly for product details.
I simply would like to know how should I modify it to make it work aqnche products in the category.
Can you help me please? :-[




Product variables are called on the category page with   $product-> and NOT    $this->

SO, CHANGE
 $this->   to $product->

I do NOT do development work for hire.

maxispin

  • Jr. Member
  • **
  • Posts: 169
Re: $this-> VS $product->
« Reply #22 on: September 24, 2013, 05:07:22 am »
Awesome thread! People like me can actually understand a bit more about coding now. Thanks for Pro for starting this and Ivus about great hints too!
VM 3.0.17.6 | VM 2.0.24c | VM 1.1.9

poisom

  • Beginner
  • *
  • Posts: 12
Re: $this-> VS $product->
« Reply #23 on: September 26, 2013, 13:41:41 pm »
Hello,

i am trying to show the stock_level inside a productdetails page bu i cant.

i am using this code:

Code: [Select]
<span class="vmicon vm2-<?php echo $this->product->stock_level?>" title="<?php echo $this->product->stock_tip?>"></span>
i copied this code from a category page and changed the $this to work inside a product page...any help??
Joomla 3.4.1 - Virtuemart 3.0.9.4

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2661
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: $this-> VS $product->
« Reply #24 on: September 26, 2013, 14:54:35 pm »
i copied this code from a category page
Which code?
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart

poisom

  • Beginner
  • *
  • Posts: 12
Re: $this-> VS $product->
« Reply #25 on: September 27, 2013, 09:42:53 am »
i copied this code from a category page
Which code?

Code: [Select]
<span class="vmicon vm2-<?php echo $this->product->stock_level?>" title="<?php echo $this->product->stock_tip?>"></span>
you don;t see the code tags??
Joomla 3.4.1 - Virtuemart 3.0.9.4

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2661
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: $this-> VS $product->
« Reply #26 on: September 30, 2013, 06:20:33 am »
Nope. I don't see original code. BTW the first pages of each of those two sticked threads about Template Overrides in this forum section could give you a hint.
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart

isuv

  • Beginner
  • *
  • Posts: 49
Re: $this-> VS $product->
« Reply #27 on: October 02, 2013, 09:59:45 am »
Hello,

I have Joomla 2.5.14 and VM 2.0.18b. I used this solution http://forum.virtuemart.net/index.php?topic=106732.0 to display related products prices on a product details page. But after I began to use different prices for registered and not registered users the prices of related products disappeared. There were "0" instead of prices. So, as I understand, I need to correct this code somehow:
$product = $model->getProductSingle($field->custom_value,false);
$price = $calculator -> getProductPrices($product);
echo $currency->priceDisplay($price['salesPrice']);
Can you help me with this?

Maxim Pishnyak

  • Virtuemart 2 is quite bugfree now
  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2661
  • Virtuemart 2 is quite bugfree now
    • Virtuemart Ukraine division
Re: $this-> VS $product->
« Reply #28 on: October 03, 2013, 16:22:55 pm »
Version is outdated.
Virtuemart 2 is quite bugfree now. You can support Community by voting for Project on the JED
http://extensions.joomla.org/extensions/e-commerce/shopping-cart/129/review
Join us in
https://www.facebook.com/virtuemart
https://twitter.com/virtuemart

Robert_ITMan

  • Jr. Member
  • **
  • Posts: 82
    • websites developed and managed @ ourfingertips.ca
  • VirtueMart Version: 2.6.22
Re: $this-> VS $product->
« Reply #29 on: November 07, 2013, 19:48:49 pm »
you don;t see the code tags??

poisom - did you figure this out yet? I posted a solution here:  http://forum.virtuemart.net/index.php?topic=92756.msg409006#msg409006
www.ourfingertips.ca - websites developed and managed @ ourfingertips

Let me help you make the most of the technology at our fingertips