Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Concrete5 --> SilverStripe || MODX?


Go to End


13 Posts   9092 Views

Avatar
neilcreagh

Community Member, 136 Posts

6 March 2012 at 1:50am

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

Avatar
Chris_Bryer

Community Member, 35 Posts

7 March 2012 at 6:44pm

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

Avatar
neilcreagh

Community Member, 136 Posts

7 March 2012 at 10:53pm

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);

But the warning still says "A reference to a non secure css file was found"

Thanks!

Avatar
ChrisBryer

Community Member, 95 Posts

8 March 2012 at 9:40am

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);

foxycart then finds the images and pulls them into their environment, pulls the html into their environment and rewrites the links.

-Chris

Avatar
neilcreagh

Community Member, 136 Posts

8 March 2012 at 11:06pm

Makes sense, thanks Chris - great work!

Go to Top