Datafeedr Support Forums

Datafeedr Support Forums (/index.php)
-   Questions (/forumdisplay.php?f=67)
-   -   Brand and Merchant Variables in PHP (/showthread.php?t=6775)

crazysaver April 18th, 2012 07:21 AM

Brand and Merchant Variables in PHP
 
Hi - I'm working on improving the related products at the bottom of my product details pages.

So far, I've included
'Other [category.name]'
and then use

[DFR:CustomView?c=<?php echo $category->id ?>]

to display a small set of alternate products.

I need access to the brand and merchant variables too and the product description and product name all from PHP rather than using shortcodes.

I tried guessing at $brand->name but it didn't work.

Is there anywhere that lists these PHP variables too?

crazysaver April 18th, 2012 07:24 AM

Also, it would be useful if I could access the price as well.

Eric April 18th, 2012 08:33 AM

Hi

You have access to all Product information in the $product Object. On your product details page in a Text module add this:

HTML Code:

<pre><?php print_r($product); ?></pre>
That will display what's in the $product Object. For one of my product it displays this:

Code:

stdClass Object
(
    [id] => 128400983332994
    [net_id] => 6
    [net_code] => ss
    [network] => ShareASale
    [merchant_id] => 1284
    [merchant] => Altrec
    [name] => Salomon Women's Origins Opal Skis w/ 10 Bindings
    [slug] => salomon-womens-origins-opal-skis-w-10-bindings
    [description] => High performance and stable one-ski-quiver with maximum versatility to explore the resort on and off-piste.
    [price] => 100.00
    [image] => http://www.altrec.com/images/shop/detail/swatches/SAL/8.79670_d.jpg
    [thumbnail] => http://www.altrec.com/images/shop/detail/swatches/SAL/8.79670_s.jpg
    [url] => http://www.shareasale.com/m-pr.cfm?merchantID=15547&userID=169381&productID=478830276&afftrack=REFERRER_ID
    [tags] => sports-outdoors,sports,outdoors,outdoors-camping,camping,skis,all-mountain-skis,all,mountain
    [saleprice] => 0.00
    [brand] => Salomon
    [currency] => USD
    [sku] => 79670
    [model] =>
    [ean] =>
    [isbn] =>
    [asin] =>
    [amlocale] => 0
    [shipprice] => 0.00
    [sprice] => 0.00
    [promo] =>
    [specs] =>
    [site_link] => store/mens/salomon-womens-origins-opal-skis-w-10-bindings.html
    [cat_id] => 591458
    [state] => 1
    [legacy_id] => 478830276-15547-ss
    [qrnd] => 14056
    [cfields] =>
    [views] => 3
    [clicks] => 0
    [compset_status] => 0
    [upd_ts] => 1334513130
    [drip_ts] => 0
)

To access the brand name I can get it from this PHP:
PHP Code:

$product->brand 

To access the merchant name I can get it from this PHP:
PHP Code:

$product->merchant 

Hope that helps,
Eric


All times are GMT -5. The time now is 12:56 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.