Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

dyland

Archived
  • Posts

    102
  • Joined

  • Last visited

Profile Information

Recent Profile Visitors

5,024 profile views

dyland's Achievements

  1. Change hosts :thumbsup: I had this issue with GoDaddy for a client, never found anything better than a manual work around.
  2. To put FTP into passive mode: ftp_pasv ( $conn_id, true ) ; I've seen that error when you try to upload the file twice quickly and is caused by the old file still being there - Froogle haven't picked it up and processed it. Dylan
  3. FTP changing directory code is kind of hidden so I've copied it below: if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n"; } else { echo "Couldn't change directory on $ftpservername<BR>\n"; return false; } Just set $ftpdirectory to the directory you want.
  4. To change directory using PHP and FTP: if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n"; } else { echo "Couldn't change directory on $ftpservername<BR>\n"; return false; } In fact I put the ftp stuff into a function to make it easier to extend: function ftp_file( $ftpservername, $ftpusername, $ftppassword, $ftpsourcefile, $ftpdirectory, $ftpdestinationfile ) { // set up basic connection $conn_id = ftp_connect($ftpservername); if ( $conn_id == false ) { echo "FTP open connection failed to $ftpservername <BR>\n" ; return false; } // login with username and password $login_result = ftp_login($conn_id, $ftpusername, $ftppassword); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!<BR>\n"; echo "Attempted to connect to " . $ftpservername . " for user " . $ftpusername . "<BR>\n"; return false; } else { echo "Connected to " . $ftpservername . ", for user " . $ftpusername . "<BR>\n"; } if ( strlen( $ftpdirectory ) > 0 ) { if (ftp_chdir($conn_id, $ftpdirectory )) { echo "Current directory is now: " . ftp_pwd($conn_id) . "<BR>\n"; } else { echo "Couldn't change directory on $ftpservername<BR>\n"; return false; } } ftp_pasv ( $conn_id, true ) ; // upload the file $upload = ftp_put( $conn_id, $ftpdestinationfile, $ftpsourcefile, FTP_ASCII ); // check upload status if (!$upload) { echo "$ftpservername: FTP upload has failed!<BR>\n"; return false; } else { echo "Uploaded " . $ftpsourcefile . " to " . $ftpservername . " as " . $ftpdestinationfile . "<BR>\n"; } // close the FTP stream ftp_close($conn_id); return true ; }
  5. I moved a site from a Unix platform to a Windows platform and had a lot of issues, not least was this register globals problem. Anyway used this contrib and it helped in the fix. A couple of issues I had (and fixed) on a Windows box: 1 - a partial page was displaying or the page was redirecting constantly. Only an issue on Internet Explorer and not Mozilla. The cause was buffering but I couldn't fix it until I found if I turned off gzip support it stopped the HTTP compression and this issue went away. (do this through the admin screens) 2 - Problem with backups and uploading images. Still working on this. My theory is the site is running as a user id that doesn't have write persmission on the directorys in question. 3 - There appears to be a bug in the admin patch labeled 030740. The problem was the admin security wasn't working and access to /admin/index.php (amongst others) was possible without logging in. The code in /admin/includes/functions/general.php had to be modified as follows: // Redirect to another page or site function tep_redirect($url) { //-----Comment this line out ---> return stristr($_SERVER['HTTP_USER_AGENT'], $url); //global $logger; header('Location: ' . $url); if (STORE_PAGE_PARSE_TIME == 'true') { if (!is_object($logger)) $logger = new logger; $logger->timer_stop(); } exit; } 4 - I have a ton of contribs loaded and had to go to the less strict version of the sessions mapping code. 5 - I was getting warning messages about using a side effect from earlier versions of PHP. I used the '@' to suppress warnings in the following code (in /includes/functions/sessions.php ) if (PHP_VERSION >= '4.0.4') { return @session_write_close(); } elseif (function_exists('session_close')) { return session_close(); } Dylan
  6. For anyone that's interested I have put below SQL that integrates the specials price checking into the SQL statement where its a lot faster. Of course if you have two specials loaded for future dates it might give some weird resutls but give it a try. I haven't kept up with this thread since it was started so long ago now, so this SQL may not be totally compatible with the current froogle release. Dylan select concat( '$ProductURL' ,products.products_id) AS product_url, products_model , products_weight , products_quantity , manufacturers.manufacturers_name , products_description.products_name AS name, products_description.products_description AS description, FORMAT( ifnull( specials.specials_new_products_price , products.products_price ) ,2) AS price, CONCAT( '$ImageURL' ,products.products_image) AS image_url, concat_ws( '$StandardDelimiter' , catdescparent.categories_name , catdesccurrent.categories_name ) AS category , categories.shopping_com_id , products.products_id FROM categories , products, products_description, categories_description as catdesccurrent, products_to_categories left join categories_description as catdescparent on ( catdescparent.categories_id = categories.parent_id ) left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id ) left join specials on ( specials.products_id = products.products_id and specials.expires_date > CURRENT_DATE) WHERE products.products_id=products_description.products_id AND products.products_id=products_to_categories.products_id AND products_to_categories.categories_id=categories.categories_id AND catdesccurrent.categories_id = categories.categories_id and products.products_status != 0
  7. Looks OK (though a very early version of the code). Take the output file and load it into Excel or equivalent as tab delimited see if all the columns line up. As for specials, I wasted an hour on Monday looking at correlated subqueries, dang I couldn't get the things to work. Probably a left join with some programmic logic will do the trick - probably a better solution anyway. Let me look at it and see what I can get happening. Dylan
  8. Run the following SQL from phpMyAdmin or whatever console you're using: UPDATE `products_description` SET `products_head_title_tag` = concat(`products_name` ," from Custom Made Crafts"), `products_head_desc_tag` = concat( `products_name` , " from Custom Made Crafts"), `products_head_keywords_tag` = concat(`products_name` ," ,hand made crafts, custom made crafts"); You will need to put in your keywords of course. I do need to mod this to pick yup the keywords per section. Dylan
  9. I did the same. Edit /includes/header_tags.php There's three lines per setion that read something like: if (HTDA_ALLPRODS_ON=='1') { $the_desc= $the_category['categories_name'] . " " . $the_manufacturers['manufacturers_name'] . " | " . HEAD_DESC_TAG_ALLPRODS . ' ' . HEAD_DESC_TAG_ALL; } else { $the_desc= HEAD_DESC_TAG_ALLPRODS; } Swap the fields around as you want them. Dylan
  10. wvmit: I was using a define at the top of the code I didn'tinclude. I've gone away from that so I can cut and paste the SQL between PHP and mySQL. I have expanded the whole code to feed shopping.com, bizrate.com and no doubt more will follow. However my paying job (I own an SEO company) has dragged me away to programming ASP for a few days. I have added a few custom table columns to the mix: shopeng_shopping_com - shopping.com has its own categories you need to use - this is a lookup table for them. products.products_MPN , products.products_UPC - both needed for shopping.com & bizrate.com. If you don't plan on using either system then these lines can be deleted. The current SQL is as follows: $ImageURL = 'http://www.custommadecrafts.com/images/' ; $ProductURL = 'http://www.custommadecrafts.com/product_info.php?products_id=' ; $StandardDelimiter = " > " ; $sql = " select concat( '$ProductURL' ,products.products_id) AS product_url, products_model , products_weight , products_quantity , manufacturers.manufacturers_name , products_description.products_name AS name, products_description.products_description AS description, FORMAT(products.products_price,2) AS price, CONCAT( '$ImageURL' ,products.products_image) AS image_url, concat_ws( '$StandardDelimiter' , catdescparent.categories_name , catdesccurrent.categories_name ) AS category , categories.shopping_com_id , shopeng_shopping_com.shopping_category , products.products_MPN , products.products_UPC FROM categories , products, products_description, categories_description as catdesccurrent, products_to_categories left join categories_description as catdescparent on ( catdescparent.categories_id = categories.parent_id ) left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id ) left join shopeng_shopping_com on ( shopeng_shopping_com.shopping_com_id = categories.shopping_com_id ) WHERE products.products_id=products_description.products_id AND products.products_id=products_to_categories.products_id AND products_to_categories.categories_id=categories.categories_id AND catdesccurrent.categories_id = categories.categories_id and products.products_status != 0 " ; thewitt: You have a nasty dilemma. You can't use SQL - at least not without subselects and other deep SQL changes, perhaps an associative PHP array will help. Do you know or care which one of your duplicate products is output? If not something alone the lines of (I haven't tested this): $AlreadySent = array() ; $result=mysql_query( $sql )or die( $FunctionName . ": SQL error " . mysql_error() . "| sql = " . htmlentities($sql) ) ; while( $row = mysql_fetch_object( $result ) ) { if ( $AlreadySent[ $row->products_model ] == 1 ) continue ; $AlreadySent[ $row->products_model ] = 1 ; ....format output bit. } // end of while loop If you care which ones are output - how can you tell which ones to do? Dylan
  11. If you're just after a Froogle data feed I posted the code I wrote for one that is fully automated (can be run from cron, FTPs the file) - Original Thread . I wrote it (or more correctly, modified someone else's code) because the other solutions require someone to manual intervene and I kept forgeting to run it. Dylan
  12. Use strip_tags and the following code: $_strip_search = array( "![\t ]+$|^[\t ]+!m", // remove leading/trailing space chars '%[\r\n]+%m'); // remove CRs and newlines $_strip_replace = array( '', ''); preg_replace($_strip_search, $strip_replace, strip_tags( $data_to_send ) ) ; Dylan
  13. $OutFile you defined yourself (hopefully) - I defined mine to (OSC homedir)/temp/froogle.txt. Make sure your output directory exists and is writable (you were chmod the code - need to chmod the output directory). Make it a temp directory - get it away from the OSC code - also allows expansion to other shopping engines (see later). BTW I changed the SQL just a tad ... it was including out of stock items so I added a criteria to stop that. The new sql code is as follows: $sql = " select concat( '" . PRODUCTURL . "' ,products.products_id) AS product_url, products_model , products_weight , manufacturers.manufacturers_name , products_description.products_name AS name, products_description.products_description AS description, FORMAT(products.products_price,2) AS price, CONCAT( '" . IMAGEURL . "' ,products.products_image) AS image_url, concat_ws( ' > ' , catdescparent.categories_name , catdesccurrent.categories_name ) AS category FROM categories , products, products_description, categories_description as catdesccurrent, products_to_categories left join categories_description as catdescparent on ( catdescparent.categories_id = categories.parent_id ) left join manufacturers on ( manufacturers.manufacturers_id = products.manufacturers_id ) WHERE products.products_id=products_description.products_id AND products.products_id=products_to_categories.products_id AND products_to_categories.categories_id=categories.categories_id AND catdesccurrent.categories_id = categories.categories_id and products.products_status != 0 " ; I've also expanded to include Yahoo Shopping, I'm working on shopping.com (ugly ... needs at least 3 new fields in the database), then to the rest (bizrate, etc). If you want the Yahoo shopping version PM me and I'll email you the code. Dylan
  14. Edit the two configure files to point to the correct directory (i.e. without /catalog) Dylan
  15. For tax, the field product.products_tax_class_id gives you how the item is to be taxed, and a function tep_get_tax_rate (found in general.php) gives you the SQL/PHP to convert this into a value. You could combine all this into the SQL above but its going to take a bit of playing to ensure you get everything correct. Shipping is more diffidult as its based on the person's location and your location. There's a 'shipping_estimator.php' module that contains the code - I think this is an add-on. Dylan
×
×
  • Create New...