Author Topic: Loading New Thumbs 2.0.21e  (Read 4090 times)

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Loading New Thumbs 2.0.21e
« on: June 06, 2013, 23:54:28 pm »
In the 2.0.21c I am working on getting the new images loaded for the products I am pulling up.

Could I get a little help. I am able to get my $limit of 4 items with price formatted a buy button and the products name. I am also able to get the products media id however I am having an issue getting the thumb to display as it is no longer stored in the db.

Would this be in a close direction?
Code: [Select]
$images = VmMediaHandler::getThumbPath();

if (!empty($product->file_url_thumb['forSale_path_thumb'])) {

echo $images->displayMediaThumb('forSale_path_thumb', '', $product->file_url_thumb, TRUE);

}

I keep getting "Using $this when not in object context"
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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Loading New Thumbs 2.0.21c
« Reply #1 on: June 07, 2013, 11:19:20 am »
$images = VmMediaHandler::getThumbPath();

you dont need that. You make it much more complex than it is. Please check how we use it. You dont need to know any urls or paths to use a media.
Code: [Select]
if (!empty($product->file_url_thumb
I think this is old vm1 code there
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: Loading New Thumbs 2.0.21c
« Reply #2 on: June 07, 2013, 18:49:43 pm »
The $product->file_url_thumb  is the code I used in my module. I am take the current product being viewed and comparing it to the order history to see what others purchased with that product. Here is the original code I had to load the images with a link
Code: [Select]
<?php
echo 
'<div align="center" style="padding:5px;">';
echo JHTML::('link'JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' $product->virtuemart_product_id '&virtuemart_category_id=' $product->virtuemart_category_id ) . '"><img style="border-radius: 5px 5px 5px 5px; display: block; height: auto; width:auto; margin-bottom: 15px; overflow: hidden;" align="center" src="' $product->file_url_thumb .'" alt="'.$product->product_name '" title="' $product->product_name );

echo '</div>'?>
But due to the change in how thumbs are stored it will no longer load the thumbs. Being that the "latest products" "featured products" and "Top Ten" are also not loading the thumb I am having difficulty finding a code to compare and where to start in how loading the thumbs works.

Just to clarify.
Code: [Select]
<?php foreach ($products as $product) { ?> is how I am getting my rows from my query.

Am I correct in my assumption that mediahandler.php is the file with the class I need to call to load the thumbs? I am so close and just a little nudge in the right direction would be awesome. I will even share with you the code I have so you can slap me with a bit of wake up call if that helps.
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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Loading New Thumbs 2.0.21c
« Reply #3 on: June 07, 2013, 18:52:58 pm »
ahhhhh $product->file_url_thumb

Where does this come from? Did it ever worked in vm2? We use since vm2.0.0 imho echo $product->images[0]->displayMediaThumb();
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: Loading New Thumbs 2.0.21c
« Reply #4 on: June 07, 2013, 19:44:20 pm »
Yes it worked in vm 2.0.20b. I am trying to now load using
Code: [Select]
if (!empty($product->images[0])) {

$image = $product->images[0]->displayMediaThumb ('class="featuredProductImage" border="0"', FALSE);

} else {

$image = '';

}

echo JHTML::_ ('link', JRoute::_ ('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id), $image, array('title' => $product->product_name));
to no avail. I think maybe I should just strip the mod_virtuemart_product down and use it for all the module stuff except my sql query.

www.myrepos.stonedfury.com/mod_cust_last_buy.zip is the working module with 2.0.20b to see what I was using that worked. I know it's not as professional coding but I got it to do exactly what I wanted and since have added other stuff I am working on. Then the image thumbs changed

I know there is some useless code in the module that I have been removing as some of it was just learning curves.
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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Loading New Thumbs 2.0.21c
« Reply #5 on: June 07, 2013, 21:39:38 pm »
Interesting, I think about to add a kind of backward compatibility, so that you can still use your code. Please check next version with your old code.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: Loading New Thumbs 2.0.21c
« Reply #6 on: June 10, 2013, 18:01:44 pm »
Interesting, I think about to add a kind of backward compatibility, so that you can still use your code. Please check next version with your old code.
I do appreciate that sir.

I also do wish I was able to get it to function as the new VM requires. I keep looking into the image.php to see if I can discover what I am missing. This is a learning curve and I know I can bash my head through it. Everytime I try to call the VmImages I get "using $this when not an object" :(

I have the product name, id, media id, media name, price but I just can't figure that damn thumbs. lol
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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Loading New Thumbs 2.0.21c
« Reply #7 on: June 12, 2013, 14:02:27 pm »
should be in 2.0.21D. You still think not in objects. The medias are objects and display themselfs. Just trust the function displayMediaThumb
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: Loading New Thumbs 2.0.21c
« Reply #8 on: June 17, 2013, 20:47:05 pm »
Hi Milbo,

Yes I am still thinking in the wrong context. I am trying to educate myself but I can't find working examples to learn from. Ones that fit my educational requirements. lol

I have installed the 2.0.21e and reset the thumbs to size 200, went into the tools > Tools and Migration > Reset Thumbs (after I changed to 200px in template)

The module didn't load the thumbs. Then went to to the Shop > Media Files >  Synchronize media to VirtueMart  and I get no thumbs in the module and I get this error.

I do not want to sound like I am expecting you to do the work for me or even tell me how to figure it out. I always appreciate any help, feedback and even constructive criticism that helps my knowledge grow.

Site www.mydev.stonedfury.com


[attachment cleanup by admin]
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.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10124
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Loading New Thumbs 2.0.21e
« Reply #9 on: June 18, 2013, 00:35:09 am »
Everything good. I just wonder, is the file there? /mydev/dev? two subfolders?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Stonedfury

  • Jr. Member
  • **
  • Posts: 266
    • Stonedfury
  • Skype Name: Stonedfury
  • VirtueMart Version: 2.0.24
Re: Loading New Thumbs 2.0.21e
« Reply #10 on: June 18, 2013, 00:55:37 am »
I was following instructions for setting up a development.

I did an edit trying to learn more about arrays.

Reverted back to what would be working on 2.0.20b
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.