mvbaxter
Forum Replies Created
-
Forum: Plugins
In reply to: [Woocommerce osCommerce Import] Images not importedCheck to see if you have CURL running on your PHP5 server. If so, but still not working, let me know. I can post the entire file via download URL, with instructions on what to look for and what to modify. If not, you’ll know what to ask of your web host. 🙂
Forum: Plugins
In reply to: [Woocommerce osCommerce Import] Images not importedHere is what worked for me. Please note that I hard-coded the name of our images folder, rather than taking the time to create an options field where you could indicate the images folder input field [recommended]. You may need to modify that to match yours.
// new function to validate url for image to import function woocommerce_osc_validate_url($url){ $ch = curl_init($url); $opts = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser CURLOPT_URL => $url, // set URL CURLOPT_NOBODY => true, // do a HEAD request only CURLOPT_TIMEOUT => 5); // set timeout curl_setopt_array($ch, $opts); $retval = curl_exec($ch); // do it! if ($retval !== FALSE){ $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $retval = ($code == 200 ? TRUE : FALSE); // check if HTTP OK curl_close($ch); // close handle } // END IF return $retval; }// modified the import_image function to use the CURL validator above function woocommerce_osc_import_image($url){ $attach_id = 0; $wp_upload_dir = wp_upload_dir(); $filename = $wp_upload_dir['path'].'/'.basename($url); if(file_exists($filename)) $url = $filename; // checking two folders because some fool stuffed some of our images in each // first look in default /img/ folder. $enc_url = rtrim($_POST['store_url'],'/').'/img/'.rawurlencode(basename($url)); // if not found, look in /images/ folder if (woocommerce_osc_validate_url($enc_url)===FALSE) $enc_url = rtrim($_POST['store_url'],'/').'/images/'.rawurlencode(basename($url)); // using CURL again, to copy file, for efficiency and to detect success/failure $fp = fopen($filename,'w'); $ch = curl_init($enc_url); curl_setopt($ch, CURLOPT_FILE, $fp); $data = curl_exec($ch); curl_close($ch); fclose($fp); // only create attachment information if the file copied successfully if ( $data === TRUE){ // the file copied correctly $wp_filetype = wp_check_filetype(basename($filename), null ); $attachment = array( 'guid' => $wp_upload_dir['url'] . '/' . basename( $filename ), 'post_mime_type' => $wp_filetype['type'], 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)), 'post_content' => '', 'post_status' => 'inherit' ); // Not sure why '37' but it is working, so I'll leave it... $attach_id = wp_insert_attachment( $attachment, $filename, 37 ); require_once(ABSPATH . 'wp-admin/includes/image.php'); $attach_data = wp_generate_attachment_metadata( $attach_id, $filename ); wp_update_attachment_metadata( $attach_id, $attach_data ); } return $attach_id; }Hope this helps!
Forum: Plugins
In reply to: [Woocommerce osCommerce Import] Images not importedFound and fixed my problems.
- My client’s Non-std OSC installation had images in a different folder than the importer expected. Edited the importer to correct this.
- The importer was importing dummy files with 654k in size, none of which contains anything, because the target URL didn’t point to a real file. Added a cURL function to check for the actual existence of the file in the URL. If it doesn’t existing, nothing is processed.
If this plugin gets updated, I recommend placing a field where a user could indicate the location of their respective image folders. This would have solved my problem.
Forum: Plugins
In reply to: [Fast Secure Contact Form Newsletter] Interest update letterAdded the following code to the listSubscribe() function in CC_SuperClass. This allows me to add to my lists, rather than replacing them:
// Check if email already exists; update if it does if($existingID = self::CC_Contact()->subscriberExists($params['email_address'])) { //added next three lines to ensure our new selection adds to our subscribed lists, instead of replacing them... $contactDetails = self::CC_Contact()->getSubscriberDetails($params['email_address']); $contactLists = $contactDetails['lists']; $params["lists"] = array_unique(array_merge($contactLists, $params["lists"])); //end of new code $contactXML = self::CC_Contact()->createContactXML((string)$existingID,$params);Forum: Fixing WordPress
In reply to: Admin widgets page no longer workingThanks for the suggestions, but I have tried just about every combination I could think of, including a fresh install, with twenty ten and no active plugins. The only consistent issue seems to be wordpress 3.1.1 with a non-firefox browser.
Forum: Fixing WordPress
In reply to: Admin widgets page no longer workingI have multiple sites. The 3.0 sites don’t have the problem, but the 3.1 sites do. They are on different hosts, and some are upgrades from 3.0 to 3.1, while two others are brand new installations.
I can modify the widgets, and use drag/drop, in Firefox. I get inconsistent and sometimes strange results from Chrome, IE7 & IE8.
You might try Firefox until somebody gets around to diagnosing and/or fixing this!