Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

uksitebuilder

Pioneers
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • Real Name
    Simon Powers

uksitebuilder's Achievements

  1. I installed v3.34 of this module. It works fine except for orders placed using Paypal IPN or Nochex APC and probably other payment methods that bypass checkout_process.php It seems the session was not created when a user chose these payment methods because after confirmation, they are whisked off to the payment provider's site, and therefore the coupon was not marked as used for that user even though the order and amounts/discounts went through fine. This meant the user could re-use the same coupon code at a later date. As Paypal IPN is used quite a lot, I thought I would post my hack/fix here open catalog/ext/modules/payment/paypal_ipn/ipn.php find: if ($_POST['payment_status'] == 'Pending') { $comment_status .= '; ' . $_POST['pending_reason']; Add after: // UKSB Apply discount coupon //Check to see if the discount coupon has already been applied to the order $discount_to_order_query = tep_db_query("select * from discount_coupons_to_orders WHERE orders_id = " . $_POST['invoice'] . " limit 1"); if (tep_db_num_rows($discount_to_order_query) == 0) { //Let's see if the order total table has a discount code in it $discount_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " WHERE orders_id = " . $_POST['invoice'] . " and class = 'ot_discount_coupon' limit 1"); if (tep_db_num_rows($discount_query) > 0) { $discount = tep_db_fetch_array($discount_query); //Fish the code out of the entry - Title is usually in the format of 'Discount Coupon XXXXXX Applied:' $coupon = str_replace("Discount Coupon ", "", $discount['title']); $coupon = str_replace(" applied:", "", $coupon); $sql_data_array = array( 'coupons_id' => $coupon, 'orders_id' => $_POST['invoice'] ); tep_db_perform( 'discount_coupons_to_orders', $sql_data_array ); } } // UKSB End Apply Discount Coupon find: $comment_status .= ", \n" . PAYPAL_ADDRESS . ": " . $_POST['address_name'] . ", " . $_POST['address_street'] . ", " . $_POST['address_city'] . ", " . $_POST['address_zip'] . ", " . $_POST['address_state'] . ", " . $_POST['address_country'] . ", " . $_POST['address_country_code'] . ", " . $_POST['address_status']; Add after: // UKSB Apply discount coupon //Check to see if the discount coupon has already been applied to the order $discount_to_order_query = tep_db_query("select * from discount_coupons_to_orders WHERE orders_id = " . $_POST['invoice'] . " limit 1"); if (tep_db_num_rows($discount_to_order_query) == 0) { //Let's see if the order total table has a discount code in it $discount_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " WHERE orders_id = " . $_POST['invoice'] . " and class = 'ot_discount_coupon' limit 1"); if (tep_db_num_rows($discount_query) > 0) { $discount = tep_db_fetch_array($discount_query); //Fish the code out of the entry - Title is usually in the format of 'Discount Coupon XXXXXX Applied:' $coupon = str_replace("Discount Coupon ", "", $discount['title']); $coupon = str_replace(" applied:", "", $coupon); $sql_data_array = array( 'coupons_id' => $coupon, 'orders_id' => $_POST['invoice'] ); tep_db_perform( 'discount_coupons_to_orders', $sql_data_array ); } } // UKSB End Apply Discount Coupon As you can see above, I marked the coupon as used if the payment was authorised as pending or completed. It is up to you if you don't want to do that - Just don't do the first find/add-after. You can use this hack/fix for other payment methods too which use a similar method of IPN Callback. Just be careful with the order_id post variable as this probably will be called something else. It is a dirty hack, but it works in the absence of a better solution Use at your own risk.
  2. Anybody know how to get this working correctly with Ultimate SEO URLs? I mean it works fine on my site, but I would like the URLs to be more search engine friendly to tie in with the rest of my store and to make it more search engine friendly. Any ideas?
  3. That is strange. My fix should only work / write the index file if the options in the admin are all set to false However, we can try it and change it if needed to work for you. 1. Add my fix to your file. Try creating the sitemaps. if the sitemapindex has no lines 2. Try setting the 3 sitemaps in the admin options to false and generate your sitemaps again. if it works then 3. Replace the function with the following function GenerateSitemapIndex(){ $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; $content .= '<?xml-stylesheet type="text/xsl" href="gss.xsl"?>' . "\n"; //human readable $content .= '<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; // Added by uksitebuilder to fix sitemapindex write when no extra sitemaps are set to true in the config $iscompressed = (defined('GOOGLE_SITEMAP_COMPRESS')?(GOOGLE_SITEMAP_COMPRESS == 'true'?'.gz':''):''); $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . 'sitemapcategories.xml'.$iscompressed.'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($this->savepath . 'sitemapcategories.xml'.$iscompressed)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . 'sitemapproducts.xml'.$iscompressed.'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($this->savepath . 'sitemapproducts.xml'.$iscompressed)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; // End of addition by uksitebuilder $pattern = defined('GOOGLE_SITEMAP_COMPRESS') ? GOOGLE_SITEMAP_COMPRESS == 'true' ? "{sitemap*.xml.gz}" : "{sitemap*.xml}" : "{sitemap*.xml}"; foreach ( glob($this->savepath . $pattern, GLOB_BRACE) as $filename ) { if ( eregi('index', $filename) ) continue; if ( eregi('manufacturers', $filename) && GOOGLE_XML_SITEMAP_CREATE_MANU != 'true' ) continue; if ( eregi('pages', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue; if ( eregi('specials', $filename) && GOOGLE_XML_SITEMAP_CREATE_SPECIALS != 'true' ) continue; $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; } # end foreach $content .= '</sitemapindex>'; return $this->SaveFile($content, 'index'); } # end function Hope it helps
  4. Hi, see my post @ #371 Seems you have the exact same problem that I had Hope it helps
  5. File: sitemap.class.php Two occurrences in: generatesitemap() function and generatesitemapindex() function. After cahnging and running, look at all the generated files to make sure they all have the following at the very top: <?xml version="1.0" encoding="UTF-8"?>
  6. See the first part of my reply/post @ #369 This should correct the missing XML tag
  7. re the $content bug this need to be fixed in both generatesitemap() and generatesitemapindex() functions and the latter does not use the generatesitemap() function
  8. OK, I think I figured out what is wrong. Currently, If none of the extra sitemaps are set to true in the configuration (Manufacturers, Pages, Specials), then sitemapindex.xml is incorrectly written (see post above) However, if any of the three extra sitemaps are set to true, sitemapindex.xml is written correctly. I fixed the above by rewriting the function in sitemap.class.php Here's my revised function: function GenerateSitemapIndex(){ $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; $content .= '<?xml-stylesheet type="text/xsl" href="gss.xsl"?>' . "\n"; //human readable $content .= '<sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; // Added by uksitebuilder to fix sitemapindex write when no extra sitemaps are set to true in the config if (GOOGLE_XML_SITEMAP_CREATE_MANU == 'false'&&GOOGLE_XML_SITEMAP_CREATE_MANU == 'false'&&GOOGLE_XML_SITEMAP_CREATE_PAGES == 'false') { $iscompressed = (defined('GOOGLE_SITEMAP_COMPRESS')?(GOOGLE_SITEMAP_COMPRESS == 'true'?'.gz':''):''); $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . 'sitemapcategories.xml'.$iscompressed.'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($this->savepath . 'sitemapcategories.xml'.$iscompressed)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . 'sitemapproducts.xml'.$iscompressed.'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($this->savepath . 'sitemapproducts.xml'.$iscompressed)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; } // End of addition by uksitebuilder $pattern = defined('GOOGLE_SITEMAP_COMPRESS') ? GOOGLE_SITEMAP_COMPRESS == 'true' ? "{sitemap*.xml.gz}" : "{sitemap*.xml}" : "{sitemap*.xml}"; foreach ( glob($this->savepath . $pattern, GLOB_BRACE) as $filename ) { if ( eregi('index', $filename) ) continue; if ( eregi('manufacturers', $filename) && GOOGLE_XML_SITEMAP_CREATE_MANU != 'true' ) continue; if ( eregi('pages', $filename) && GOOGLE_XML_SITEMAP_CREATE_PAGES != 'true' ) continue; if ( eregi('specials', $filename) && GOOGLE_XML_SITEMAP_CREATE_SPECIALS != 'true' ) continue; $content .= "\t" . '<sitemap>' . "\n"; $content .= "\t\t" . '<loc>'.$this->base_url . basename($filename).'</loc>' . "\n"; $content .= "\t\t" . '<lastmod>'.date ("Y-m-d", filemtime($filename)).'</lastmod>' . "\n"; $content .= "\t" . '</sitemap>' . "\n"; } # end foreach $content .= '</sitemapindex>'; return $this->SaveFile($content, 'index'); } # end function I'm sure this can be tidied up or rewritten to work better. Or maybe this is only a fix for me on my server and a few others ?
  9. Hi all and thanks for the work done on this contrib. A couple of things with my installation seem off. Firstly, a bug fix I believe for sitemap.class.php In a couple fo places the code reads: $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; $content = '<?xml-stylesheet type="text/xsl" href="gss.xsl"?>' . "\n"; //human readable Surely tit should read: $content = '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; $content .= '<?xml-stylesheet type="text/xsl" href="gss.xsl"?>' . "\n"; //human readable Otherwise the first line will be overwritten in the string. ---------- Now for a problem I am getting. All xml files are being generated, but my sitemapindex.xml file is not being written correctly as it only contains the following: <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="gss.xsl"?> <sitemapindex xmlns="http://www.google.com/schemas/sitemap/0.84"> </sitemapindex> Any help would be appreciated
  10. A new error I got today > In function: pre_confirmation_check() > Response from PayPal: > > [security] = N/A > [RequesterCredentials] > [0] > [Credentials] > [0] > [username] = xxxx.com > [Password] = XXXXXXXXXXXXXXXX > [subject] = N/A > > [faultcode] = SOAP-ENV:Client > [faultstring] = XML syntax error
  11. Hi Guys and Dolls, I have a slight problem with the contrib in that it all works fine right up until the user completes the payment and is returned to our website. For some weird reason, the items they have ordered get doubled up when admin views the users order. The order total does not double up though. Any help would be greatly appreciated
×
×
  • Create New...