Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Wordpress plugin and shortcode

 
Reply
   X-Cart forums > Forum archive > Using X-Cart in my project > Need advice
 
Thread Tools
  #21  
Old 10-22-2009, 01:24 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default Re: Wordpress plugin and shortcode

Ok. So I created a new page and put the [xcart product="29535"]
and the page displays:
Price: ё
Add to cart

so i need to link the xcart database, and i don't know which databases I need to link to.
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #22  
Old 10-22-2009, 10:54 PM
  amy2203's Avatar 
amy2203 amy2203 is offline
 

X-Wizard
  
Join Date: Jul 2004
Location: Watford, UK
Posts: 1,506
 

Default Re: Wordpress plugin and shortcode

you need to change this code in the file"
Code:
//connect to xcart db $dbc=@mysql_connect ('****','****','****'); $dbc=@mysql_select_db('****');

to connect to your xcart database,
__________________
X-Cart version 5 (Previously 3.5-4)

Previous Versions included
BCSE Reward Points Mod
Altered Cart On Sale Mod
Wordpress Plugin

Please don't PM me for support. I help where I can on the forum and your question will more likely be answered there.

Shout me a Coffee!
Reply With Quote
  #23  
Old 10-26-2009, 02:55 PM
  boomobile's Avatar 
boomobile boomobile is offline
 

eXpert
  
Join Date: Oct 2007
Posts: 306
 

Default

Quote:
Originally Posted by boomobile

What databases do I use to replace these? What information am i looking for?

//connect to xcart db
$dbc=@mysql_connect ('****','****','****');
$dbc=@mysql_select_db('****');

I'm just re posting this question...
__________________
X Cart Ver: 4.0.14
MySQL4 4.1.22
phpMyAdmin 2.6.0
Pearl 5.6.0
PHP 5.2.1
Python 2.2.2
Server: Apache/2.0.52 (Red Hat)
OS: Linux
www.cleanlinesurf.com
1. Customer Rewards Points
2. One Page Checkout (altercart)
3. Free shipping orders over $50 as Real Time Shipping
4. Gift Certificates
-----------------------------------------------
Graphic Design | Boomobile Design, LLC
www.boomobile.com
Reply With Quote
  #24  
Old 12-10-2009, 02:10 AM
 
mojo mojo is offline
 

Newbie
  
Join Date: Dec 2005
Posts: 2
 

Thumbs up Re: Wordpress plugin and shortcode

Quote:
Originally Posted by boomobile
Ok. So I created a new page and put the [xcart product="29535"]
and the page displays:
Price: ё
Add to cart

so i need to link the xcart database, and i don't know which databases I need to link to.


I get the same result on my site but i have set all the database info and url's correctly. I've checked it all a few times and followed this thread word for word but it won't connect.

Quote:
//connect to xcart db
$dbc=@mysql_connect ('localhost','my_blog','password');
$dbc=@mysql_select_db('my_xcart');

I'm wondering if this line is specific to a version of x-cart that i'm not using??
Quote:
$q = "SELECT * FROM xcart_products LEFT JOIN xcart_pricing USING(productid) LEFT JOIN xcart_images_T ON productid=id WHERE productcode='".$product."'";



Would really love to use this if someone can help.
It's a very important plugin - it expands x-cart into the Wordpress world which opens up their whole plugin database and easy management of themes and widgets.

It's a good idea for any x-cart/Wordpress developers out there.

I'd pay for this plugin from a x-cart/wordpress shop if it existed anywhere because i could really use it.

Thanks to the OP for getting it started, any help would be great!


------------------
X-Cart version 4.1.8
PHP 5.2.9
MySQL server 5.0.77
Wordpress Version 2.8.6
Reply With Quote
  #25  
Old 06-06-2011, 11:41 AM
 
michaeltracey michaeltracey is offline
 

Newbie
  
Join Date: Jun 2011
Posts: 8
 

Default Re: Wordpress plugin and shortcode

Looks like this has been dormant for a while, last bump of post was 2009. I have a beta version of a similar plugin that may solve some of these issues here, if anyone is interested: http://forum.x-cart.com/showthread.php?t=59624 Looking for a couple people who are running WP and XCart to test.
__________________
Version 4.4.3
Reply With Quote
  #26  
Old 08-20-2012, 03:31 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: Wordpress plugin and shortcode

OK I have got this to work for 4.5.1.

Code:
<?php /* Plugin Name: Xcart Links Plugin URI: http://www.willowtreecrafts.co.uk Description: Insert your Xcart products into your posts Version: 0.1 BETA Author: Amy Gibbs Author URI: http://www.willowtreecrafts.co.uk */ /* Xcart Links (Wordpress Plugin) Copyright (C) 2009 Amy Gibbs Contact me at http://www.willowtreecrafts.co.uk This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //tell wordpress to register the xcart shortcode add_shortcode("xcart", "xcart_product_handler"); function xcart_product_handler($attr) { extract(shortcode_atts(array( 'product' => 'none', ), $attr)); //$product=m111100; //connect to xcart db $dbc=@mysql_connect ('localhost','user','password'); $dbc=@mysql_select_db('xcartdbname'); //query the xcart db $q = "SELECT * FROM xcart_products LEFT JOIN xcart_pricing USING(productid) LEFT JOIN xcart_products_lng_en USING(productid) LEFT JOIN xcart_images_T ON productid=id WHERE productcode='".$product."'"; //echo $q; $results = mysql_query($q); $productdata = mysql_fetch_assoc($results); $xcart_output= "<form name='orderform_".$productdata[productid]."' method='post' action='http://collectables.co.uk/cart.php'>"; $xcart_output= $xcart_output."<input type='hidden' name='mode' value='add' /><input type='hidden' name='amount' value='1'>"; $xcart_output= $xcart_output."<input type='hidden' name='productid' value='".$productdata[productid]."' />"; $xcart_output= $xcart_output."<div><div><img id='product_thumbnail' src='http://collectables.co.uk/images/T/".$productdata[filename]."' width='175' style='margin:5px;' alt='".$productdata[product]."' /></div><div>".$productdata[product]."</div>"; $xcart_output= $xcart_output."<div class='ProductPriceConverting' valign='top'>Price: <font class='ProductDetailsTitle'><span style='WHITE-SPACE: nowrap'>&pound;".$productdata[price]."</span></font><font class='MarketPrice'> </font></div>"; $xcart_output= $xcart_output."<div style='margin-bottom:30px;'><a class='Button' href='javascript: document.orderform_".$productdata[productid].".submit();'>Add to cart </a></div> </div> </form>"; //send back text to replace shortcode in post return $xcart_output; } ?>

Kudos to amy2203 who posted the original code.
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #27  
Old 08-20-2012, 05:06 AM
 
philrisk philrisk is offline
 

X-Adept
  
Join Date: Jul 2009
Location: Newcastle upon Tyne, UK
Posts: 412
 

Default Re: Wordpress plugin and shortcode

By adding in more to the SELECT statement you can call in clean_url for links:

Code:
$q = "SELECT * FROM xcart_products LEFT JOIN xcart_clean_urls ON productid=resource_id LEFT JOIN xcart_pricing USING(productid) LEFT JOIN xcart_products_lng_en USING(productid) LEFT JOIN xcart_images_T ON productid=id WHERE productcode='".$product."'";

Code:
".$productdata[clean_url]."
__________________
Live with Gold 4.5.1
Dedicated Linux server
MaxCDN 4 pull zones
Dedicated SSL

Reply With Quote
  #28  
Old 10-28-2012, 07:53 AM
 
designguru designguru is offline
 

X-Adept
  
Join Date: Dec 2010
Posts: 418
 

Default Re: Wordpress plugin and shortcode

Quote:
Originally Posted by philrisk
OK I have got this to work for 4.5.1.

I would like to use a mod to auto-post product thumbnails and description to a WP Blog. Does this mod do the job?

Thanks.
__________________
X-Cart Pro 4.6.2 with many modules
X-CART Pro 4.4.1
Reply With Quote
Reply
   X-Cart forums > Forum archive > Using X-Cart in my project > Need advice


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:49 AM.

   

 
X-Cart forums © 2001-2020