Jump to content

mjr

Members
  • Content count

    17
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    MJ Ray
  • Location
    Norfolk and Somerset, England
  • Interests
    Web development, Statistics, Accessibility, Internationalisation, Esperanto
  • Website
  1. When I installed the Offical Google Checkout module for osCommerce, it accepted orders fine, but the order details only existed in Google and didn't seem to get entered into osCommerce. Is this normal? If not, is it a common problem with a known solution? Or if it is, is there another module for Google Checkout I can try? Thanks.
  2. mjr

    [Contribution] STS v4

    You need to edit a function in includes/functions/sts.php that's called something like sts_strip_unwanted_tags if you want to change what get stripped off. I think it would be more robust to use the preg_* or ereg_* functions to remove the offending tr and td tags - is there anyone still running a PHP without any regex support?
  3. mjr

    Master Products - MS2

    Replace 16 with the result of select count(*)+1 from configuration_group;? Hope that helps, MJR
  4. mjr

    edgeoi feed error

    Try running the SELECT statements on the database (mysqlclient, phpmyadmin or whatever). They weren't quite right for my shop, so maybe they're not quite right for yours either.
  5. mjr

    edgeoi feed error

    You're getting that because it's trying to write to /www.######.co.uk/feeds/ instead of /home/fhlinux184/p/######.co.uk/user/htdocs/feeds/ and that's not allowed by your hosting provider's security defaults - correctly IMO. In other words, your $feedDirectory is wrong for your hosting provider. Replace the www.#######.co.uk with home/fhlinux184/p/######.co.uk/user/htdocs Hope that helps!
  6. mjr

    edgeoi feed error

    For me, that GROUP BY stops double-listing products which appear in two categories. I guess that maybe we're using different 'multiple categories' contributions.
  7. mjr

    edgeoi feed error

    I think the 'group by p.products_id' in my patch does that. Hope it works for you.
  8. mjr

    edgeoi feed error

    I've been hacking on this contribution to get it to work with google. Main problems so far: not showing prices with tax or detecting special prices, not labelling products with categories and using the wrong time format. I'm pasting the patch so far here and would welcome any comments you can offer. Use this to update your file with a patch tool (programmer editors like Emacs have them, or in the worst case, paste it to a file called edgeio.patch and then use a typical GNU/Linux command line like: patch admin/rss_edgeio.php <edgeio.patch, but watch for lines it couldn't figure out). It will probably fail on the second chunk if you've already configured siteUrl and so on, but the change there is pretty simple: rename language to xmllanguage and set ttl to 30 (google max is 31, as far as I can see). I can see some other possible improvements, but this works for me so far. Please let me know here whether it works for you. Should I add this to the contribution page? --- admin/rss_edgeio.php 2006-07-11 18:12:46.000000000 +0100 +++ admin/rss_edgeio.php.mod 2006-07-25 13:03:28.000000000 +0100 @@ -5,6 +5,8 @@ ********************************************************** *by Andrew Yasinsky (andrew@edgeio.com) +*Updated by MJ Ray + PLEASE READ: This feed constructs default product and image urls If your images or urls are custom then i assume you know how to integrate 'em here. @@ -13,6 +15,10 @@ */ /*INCLUDE NEEDED OS COMMERCE CLASSES*/ + //MJR: use normal boot instead + require('includes/application_top.php'); + + /* require('includes/configure.php'); require(DIR_WS_FUNCTIONS . 'database.php'); tep_db_connect() or die('Unable to connect to database server!'); @@ -34,13 +40,13 @@ $feedUrl=''; //URL to $OutFile i.e. [url="http://www.mysite.com/feeds/"]http://www.mysite.com/feeds/[/url] $imageUrl = ''; //Base URL for images i.e. [url="http://www.mysite.com/images/"]http://www.mysite.com/images/[/url] $productUrl = ''; //Base url for products i.e. [url="http://www.mysite.com/product_info.php?products_id="]http://www.mysite.com/product_info.php?products_id=[/url] -$language='en-us'; +$xmllanguage='en-us'; $currency='USD'; //ISO Currency code i.e. GBP, EUR $locationCity='City'; //location of the producti.e. New York $locationState='State'; //State i.e. CA $locationZip='ZIP'; //ZIP $locationCountry='USA';//COUNTRY -$ttl=60; //Time to expiration in days minimum 30 max 90 +$ttl=30; //Time to expiration in days minimum 30 max 90 //MJR: max 31 for google $paymentAccepted=array('Cash','Visa','MasterCard','AmericanExpress'); // these values should be the same as on google base xml feed spec $locationAddress='Your Street Address, City,State,Zip'; @@ -82,7 +88,7 @@ //****************************************************** //Retrieve all product/products_description information feel free to change this -$result=tep_db_query("select * from products p, products_description pd, products_to_categories ptc where p.products_id=pd.products_id and p.products_id=ptc.products_id and p.products_quantity>0 and p.products_status=1 " . $limit); +$result=tep_db_query("select * from products p, products_description pd, products_to_categories ptc where p.products_id=pd.products_id and p.products_id=ptc.products_id and p.products_quantity>0 and p.products_status=1 group by p.products_id" . $limit); if($edgeio){ @@ -95,11 +101,11 @@ $output.='<title>'.$feedTitle.'</title>'."\n"; $output.='<link>'.$siteUrl.'</link>'."\n"; $output.='<feed>'.$feedUrl.$fileEdgeio.'</feed>'."\n"; -$output.='<language>'.$language.'</language>'."\n"; +$output.='<language>'.$xmllanguage.'</language>'."\n"; $output.='<pubDate>'.date("r").'</pubDate>'."\n"; $output.='<lastBuildDate>'.date("r").'</lastBuildDate>'."\n"; $output.='<docs>http://blogs.law.harvard.edu/tech/rss</docs>'."\n"; -$output.='<generator>Edgeio publishing script for oSCommerce 1.2</generator>'."\n"; +$output.='<generator>Edgeio publishing script for osCommerce 1.7</generator>'."\n"; while($row = tep_db_fetch_array($result)){ @@ -112,7 +118,7 @@ $output.=' <description>'.xmlentities(strip_tags($row['products_description']))."\n"; $output.=' <![CDATA['."\n"; $output.=' <img src="'.$imageUrl . $row['products_image'] . '" />'."\n" ; - $output.=' <span class="price">'.$currency.' '.number_format($row['products_price'], 2, '.', '').'</span>'."\n"; + $output.=' <span class="price">'.$currency.' '.number_format(getprice($row), 2, '.', '').'</span>'."\n"; $output.=' <abbr class="dtexpired" title="'.get_iso_8601_date(time() + ($ttl * 24 * 60 * 60)).'">'.date("F j, Y",strtotime("+".$ttl." day")).'</abbr>'."\n"; $output.=' ]]>'."\n"; $output.=' </description>'."\n"; @@ -167,16 +173,21 @@ $output.=' <description>'.xmlentities(strip_tags($row['products_description']))."</description>\n"; $output.=' <link>'.$productUrl . $row['products_id'] .'</link>'."\n"; $output.=' <g:image_link>'.$imageUrl . $row['products_image'] .'</g:image_link>'."\n"; - $output.=' <guid isPermaLink="false">'.xmlentities($siteUrl.$row['products_id']).'</guid>'."\n"; + $output.=' <guid isPermaLink="false">'.xmlentities($productUrl.$row['products_id']).'</guid>'."\n"; $output.=' <g:expiration_date>'.get_iso_8601_date(time() + ($ttl * 24 * 60 * 60)).'</g:expiration_date>'."\n"; $output.=' <g:currency>'.$currency.'</g:currency>'."\n"; - $output.=' <g:price>'.number_format($row['products_price'], 2, '.', '').'</g:price>'."\n"; + $output.=' <g:price>'.number_format(getprice($row), 2, '.', '').'</g:price>'."\n"; $output.=' <g:upc>'.$row['products_model'].'</g:upc>'."\n"; $output.=' <g:quantity>'.$row['products_quantity'].'</g:quantity>'."\n"; foreach($paymentAccepted as $key=>$value){ $output.=' <g:payment_accepted>'.$value.'</g:payment_accepted>'."\n"; } $output.=' <g:location>'.xmlentities($locationAddress.','.$locationCity.','.$locationState.','.$locationZip.','.$locationCountry).'</g:location>'."\n"; + if(isset($categorytag[$row['categories_id']])){ + foreach($categorytag[$row['categories_id']] as $key=>$value){ + $output.=' <g:label>'.xmlentities($value).'</g:label>'."\n"; + } + } $output.=' </item>'."\n"; } $output.='</channel>'."\n"; @@ -297,10 +308,12 @@ function get_iso_8601_date($int_date) { //$int_date: current date in UNIX timestamp - $date_mod = date('Y-m-d\TH:i:s', $int_date); - $pre_timezone = date('O', $int_date); - $time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2); - $date_mod .= $time_zone; + //MJR: remove \TH:i:s to stop google errors + $date_mod = date('Y-m-d', $int_date); + //MJR: don't add timezone - google hates it + //$pre_timezone = date('O', $int_date); + //$time_zone = substr($pre_timezone, 0, 3).":".substr($pre_timezone, 3, 2); + //$date_mod .= $time_zone; return $date_mod; } @@ -308,5 +321,22 @@ return str_replace ( array ( '&', '"', "'", '<', '>', '?' ), array ( '&' , '"', ''' , '<' , '>', ''' ), $string ); } +//MJR: from main catalogue general.php + function tep_get_products_special_price($product_id) { + $product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status"); + $product = tep_db_fetch_array($product_query); + + return $product['specials_new_products_price']; + } + +//MJR: specials price handling from product_info.php +function getprice($product_info_values) { + if ($new_price = tep_get_products_special_price($product_info_values['products_id'])) { + $products_price = $new_price*(100+tep_get_tax_rate($product_info_values['products_tax_class_id']))/100; + } else { + $products_price = $product_info_values['products_price']*(100+tep_get_tax_rate($product_info_values['products_tax_class_id']))/100; + } + return $products_price; +} ?> \ No newline at end of file
  9. Does anyone have this working with payment and shipping modules? Does anyone still want this working with payment and shipping modules, or is there an alternative which allows processing of orders taken offline? Thanks in advance for any replies.
×