Hi Chris,
I'm just installing the FoxyCart module and I have a few questions - like where do I enter the API key? Is there any kind of documentation you could point me towards, or could you outline the initial set-up steps? Thanks, Neil
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hi Chris,
I'm just installing the FoxyCart module and I have a few questions - like where do I enter the API key? Is there any kind of documentation you could point me towards, or could you outline the initial set-up steps? Thanks, Neil
Hey Neil,
sorry, i am lacking in documentation, but feel free to ask whatever you need here.
once you set the store name, i believe it should work well.
you would set the params in mysite/_config.php.
// set your store name ( myStoreName.foxycart.com would = myStoreName).
Foxycart::setFoxycartStoreName('myStoreName');
// set the API Key
// foxycart would then send the datafeed to www.yoursite.com/order-collection
Foxycart::setStoreKey('ABCDEFG1234567890');
you can decorate FoxyCartDataFeedCollector to do whatever you want with the data. here's an example of how you could send the information out to another service for something like order fulfillment:
//in mysite/_config.php:
Object::add_extension('FoxyCartDataFeedCollector', 'Dispatcher');
Dispatcher::setURL('https://website.com');
// in Dispatcher.php
class Dispatcher extends DataObjectDecorator {
static $url;
public function setURL($u){
self::$url = $u;
}
public function DispatchData($data){
if($data){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, self::$url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("FoxyData" => urlencode($data)));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
return 'no data';
}
public function handleDecryptedFeed($encrypted, $decrypted){
//do what you want to with encrypted & decrypted data
self::DispatchData($encrypted);
}
}
i hope it helps, please let me know how it goes, and if you have any recommendations.
-Chris
Thanks Chris.
When I set the API key in FoxyCart do I need to set the "customer password hash type" and if so, which setting is right?
And should "enable cart validation" be ticked or unticked?
Also, and I don't think this has anything to do with settings for your module so feel free to ignore this question, but do you have any idea why Foxycart would give me a warning about my CSS file when I cache my template URL for Cart/Checkout when my CSS file is only referencing cached images like so:
background-image: url(https://MYSTORE.foxycart.com/cache.php?url=http://www.MYSTORE.com/themes/MyTheme/images/topbar.gif);
Thanks!
you dont need to turn on customer password hash type. its mainly for sharing users. i never had to do that so i havent built a connector, but its nice that its possible. the module doesnt support cart validation right now either. its an anti-spoofing method to prevent people from changing prices in firebug before buying stuff, and i've never had anyone thats done that.
for the warning, its saying your'e trying to pull an image from http in an https environment, and the background image is looking for http://www.MYSTORE.com/themes/MyTheme/images/topbar.gif (non https).
ive never had to point to the foxycart cache in my css though, foxycart has always seemed to crawl relative urls, rewrite the links and import the images to their own environment.. so for example, in my css, i would write:
background-image: url(../images/topbar.gif);
-Chris
Makes sense, thanks Chris - great work!