News:

Looking for documentation? Take a look on our wiki

Main Menu

Loading New Thumbs 2.0.21e

Started by Stonedfury, June 06, 2013, 23:54:28 PM

Previous topic - Next topic

Stonedfury

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?
$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

$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.

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

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 <?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. <?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

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

Yes it worked in vm 2.0.20b. I am trying to now load using 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

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

Quote from: Milbo 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.
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

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

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

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

#10
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.