marty.net 1001 Postcards Love Love Love Meep Meep ZenZodiac DailyQuotation

YOU ARE HERE:
How to get an RSS feed from cpshop  :: cpdig

HOME

CPSHOP|

|

|

EMAIL MARTY
  marty.net message board
  « How to get an RSS feed from cpshop  :: cpdig »
Welcome, Guest. Please Login or Register.
12/11/17 at 13:11:49
Home Help Search Login Register
   marty.net message board
   About cpshop
   Tutorials
   How to get an RSS feed from cpshop  :: cpdig
(Moderator: Marty)
Pages: 1 Reply Notify of replies Send the topic Print 
   Author  Topic: How to get an RSS feed from cpshop  :: cpdig  (Read 7690 times)
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
How to get an RSS feed from cpshop  :: cpdig
« on: 01/17/07 at 00:57:51 »
Reply with quote Modify message

[EDIT: With cpshop 2.5+ you can create RSS feeds and other output formats straight from cpshop. No need to go through hoops like cpdig anymore. There's a brief example of how further down this thread.]

There are a few features we've all been hoping Marty will add to cpshop, patiently but with baited breath. Well, the ability to do so has been there all along, with a little programming and some cheap tricks, but NO HACKING OF CPSHOP's core code.

   CPDIG -- A CPSHOP UNWRAPPER

The basic method is based on scottoons' tutorial "Using CPSHOP info on other site pages." If you've read that tutorial you might remember that Scott used cpshop to dump his products and then parsed through the cpshop html formatting to extract the cpshop data he needed. What we're going to do is use cpdig, a very small perl library I've written to dig the data out of cpshop and output exactly the final formatting we want, straight from cpshop. We'll start with something of middling difficulty: an RSS feed of the ten newest dark t-shirts in your store.  Here's the resulting xml file, an RSS 2.0 formatted file generated by cpshop with cpdig.

The tutorial is too big to post in this forum, so I've placed it @ http://www.criticalgraphics.com/cpdig/cpdig_rss_tutorial.html
I don't have anything setup there for comments/feedback/support etc., so please post them in this topic.

Hopefully you'll find it useful.  Right now I'm code bleary and going to bed.

Cheers,

Patrick.
« Last Edit: 03/23/10 at 00:14:42 by Hex Angel - Patrick » Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #1 on: 01/18/07 at 21:13:37 »
Reply with quote Modify message

After further review I've penalised myself for verbosity.  The penalty?

Here's a just the facts tutorial: http://www.criticalgraphics.com/cpdig/cpdig_rss_tutorial.html

Cheers,

p.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
cjsherlock
Silver Dragon
***

Posts: 42



I'd Rather Be Diving!
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #2 on: 06/18/08 at 20:35:36 »
Reply with quote Modify message

patrick
you said in an edit that you can now pull a rss directly from cpshop now...How do you do that?

Thanks
Christopher
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to get an RSS feed from cpshop DIRECTLY
« Reply #3 on: 06/18/08 at 22:18:59 »
Reply with quote Modify message

AND HERE'S HOW TO GET RSS FEEDS FROM CPSHOP WITHOUT CPDIG

WARNING: I've extracted the following from a working installation, but haven't tested the "tutorial" below.

Just for an example, we'll create a froogle feed.

First create a new instance of cpshop, that is, copy all the cpshop.* files to something like froogle_feed.*

Now open froogle_feed.cgi and replace the if ($hacked) code with the following:


Code:
$hacked = 1;

if ($hacked) {

   &gettemplate;
     
           # remove extraneous cpshop HTML markup
     $content =~ s/<\!--.*?<item>/<item>/si;
     $content =~ s/<p>.*?<\/center>//si;
           
           # force thumbnail links to be 240X240 pixels
     $content =~ s/150X150/240X240/gi;
     
           # set the <link> URL to point to our actual store
     $content =~ s/cgi-bin\/froogle_feed.cgi\?i=//gi;
     $content =~ s/cgi-bin\/froogle_feed\.cgi\///gi;
     $content =~ s/refresh\?i=/http:\/\/www.PeaceAndLoveShop.com\//gi;
     
   $html =~ s/<\[content\]>/$content/;
           
           # Some common XML fixups
     $html =~ s/&(?!amp;)/&amp;/sgi;        # fixup untokenized ampersands
     $html =~ s/<br>/ /sgi;                    # remove <br> tags
     $html =~ s/<\/*?div.*?>/ /sgi;        # remove <div ...> and </div> tags
     $html =~ s/”/"/sgi;                              # forward double quotes
     $html =~ s/–/--/sgi;                        # n-dash
           
   unless (@ARGV) {
       print "Content-Type: text/xml\n\n";
   }
   print $html;

     exit;

} else {


Now open up cpadmin.cgi and select froogle_feed.cgi from the pulldown.

Set Default HTML template to


Code:
/server/path/to/your/template/froogle_feed.xml


I'll show you the contents of your template file later.

Set the Product Thumbnail Grid Layout to something like:


Code:
<item>
     <g:brand><[hook:brand]></g:brand>
     <title><[productname]></title>
     <g:id><[productno]></g:id>
     <description><[producttext]></description>
     <g:condition>new</g:condition>
     <g:image_link><[thumbsrc]></g:image_link>
     <link><[linksrc]></link>
     <g:price><[productcost]></g:price>
     <g:payment_accepted>Visa</g:payment_accepted>
     <g:payment_accepted>Mastercard</g:payment_accepted>
     <g:payment_accepted>American Express</g:payment_accepted>
     <g:payment_accepted>Discover</g:payment_accepted>
           
<[hook:more_attributes]>
</item>


Note the hooks. You can use these to set additional attributes for different product types, sections, etc. and to set the brand name.

Next, for Display Thumbnail Grid Table Wrapper Code? Click "NO" and make sure the before and after fields are blank.

Finally, in the storeid section create one or more storeids that will generate lists of products. eg:


Code:
criticalgraphic/1162845.all


And give each an alias.

After you've created the template just open your new  feed shop from the URL.


Code:
http://www.yourshop.com/cgi-bin/froogle_feed.cgi?i=your_alias


Now just copy the page source and save it to a file. You've got your feed.

I'll put the template you'll need in the next post.
« Last Edit: 12/23/08 at 12:49:33 by Hex Angel - Patrick » Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #4 on: 06/18/08 at 22:20:46 »
Reply with quote Modify message

A sample template file


Code:
<?xml version="1.0"?>
<rss version="2.0"
xmlns:g="http://base.google.com/ns/1.0"
xmlns:c="http://base.google.com/cns/1.0">
<channel>
<title>Peace and Love Shop</title>
<link>http://www.PeaceAndLoveShop.com/</link>
<description>Peace &amp; Love: Back by popular demand. T-shirts, hoodies &amp; other apparel; stickers, buttons, posters (and so much more) devoted to non-violence and loving kindness.</description>

<[content]>

</channel>
</rss>
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Kippygo
Silver Dragon
***

Posts: 44



Go Scots!
   

E-Mail
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #5 on: 09/05/08 at 08:55:30 »
Reply with quote Modify message

Hi there,

I followed the tutorial on your site and after a few hours managed to output something, but it's not quite right. It's leaving the td and other table tags in around the xml tags and also keeping the js links for affiliate info in toward the top of the document.

Any ideas what could be the issue? This is tricky for me and I'm not pretending to know a great deal about what's going on I'm only halfway through my xml tutorials and I don't know any languages aside from html and css!

Thanks...

Kip
Logged
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #6 on: 09/05/08 at 10:41:32 »
Reply with quote Modify message

hmmm. pm a small sample output to me.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
hexxamillion
Silver Dragon
***

Posts: 31



Live Free! It's all about open source!
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #7 on: 02/21/11 at 01:17:54 »
Reply with quote Modify message

I seem to be having some trouble with this. All I get is 500 server error. Something is misconfigured somewhere. I copied the hacked code as described only I named my dir and files cpfeed.* instead. So I adjusted that within the cpfeed.cgi (cpshop.cgi) file.

I edited the options in the cpadmin as described. Any suggestions?
Logged

My Shop: http://hexxwear.com
My Homepage: http://hexxworld.com
Hex Angel - Patrick
Gold Dragon
****

Posts: 500



Our nature lies in movement; complete calm is death.
   

WWW
Re: How to get an RSS feed from cpshop  :: cpdig
« Reply #8 on: 02/21/11 at 02:31:31 »
Reply with quote Modify message

First -- is there an error message with the 500 notification?

Second -- What happens if you try following the directions *exactly*?

Cheers,

Patrick.
Logged

CPSHOP
www.PeaceAndLoveShop.com Namaste
BLOG
www.TheNomadicSpirit.com Inspired by travel
www.GodBeautyPerfectionLove.com Inspired by spirit
www.MyMuseMoviesMusicAndBooks.com Inspired by the arts
Pages: 1 Reply Notify of replies Send the topic Print 
Jump to:


marty.net message board (http://www.marty.net/cgi/marty/board/messageboard)

Powered by YaBB 1 Gold - Release (Yet Another Bulletin Board)
Copyright 2000-2001, X-Null. All Rights Reserved.