![]() |
|
Home | Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]() Hi,
I've created my own loop outside of the Datafeedr context where I grab some products for display. All works fine, except that I can't seem to find how to dynamically get the url of the local product image. I thought of constructing it by using the $product->id, but I noticed that eg. Amazon product images are not cached locally (as might be the case for other merchants), so this is not an option. Took a quick glance at datafeedr.php, but perhaps you could point me in the right direction? Thanks! |
#2
|
||||
|
||||
![]() Hi,
The first step is to obtain the product record. If product ID is 789502110370127: PHP Code:
Then, there's a function "dfr('app')->url(kind, product)" that returns different kinds of urls for a specific product PHP Code:
Eric
__________________
![]() ![]() ![]() ![]() |
#3
|
|||
|
|||
![]() Very helpful, thank you!
For future reference, here's how one could use this to build a random product image blob: Code:
function my_awesome_product_loop( $total = 10 ) { global $wpdb; $table = $wpdb->prefix . 'dfr_shop_products'; $querystr = "SELECT * FROM $table ORDER BY RAND() LIMIT {$total}"; $products = $wpdb->get_results( $querystr ); if ( $products ) : foreach ( $products as $product ) : // Do stuff with Eric's feedback here, like: echo '<a href="' . dfr( 'app' )->url( 'click', $product ) . '" title="' . esc_attr( $product->name ) . '"><img src="' . dfr( 'app' )->url( 'image', $product ) . '" /></a>'; endforeach; endif; } |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Image zoom plugin for product image? | barbinec | Questions | 1 | March 21st, 2012 08:37 AM |
Connection Key for local development | ajstocco | Questions | 10 | January 23rd, 2012 09:32 AM |
Local product data | extrazin | Questions | 2 | October 31st, 2011 08:31 AM |