Jump to content


  • Content count

  • Joined

  • Last visited

Everything posted by gulshesh

  1. gulshesh

    Individual Shipping Prices

    Here's my problem... I've added a new attribute to TABLE_PRODUCTS called products_shipping -> decimal (5,2) / NULL I've altered the /admin/categories.php accordingly, so I't will read the values from TABLE_PRODUCTS and also write them to TABLE_PRODUCTS... no problem what so ever... easy going... The shop is set to calculate the shiping costs (only one type offered) according to its weight (0-4.9 kg = 6.9 € ; >=5 kg = 10,- €) The thing I wanna achieve now, is to alter the /includes/modules/shipping/table.php function quote() in such a fashion that it'll check if one of the products in the shoping cart has an individual shipping price saved in the Database, and if it's higher than the standard shipping costs, it'll replace the standard shipping costs. Therefore We can decide to set special shipping prices for extremely heavy or bulky items. For example an item thats lighter than the 5kg but still is so bulky we'd have to charge extra extra (15,- € for example) Now where must I set my routine to check on the database, compare the values and change the value of the shipping costs if the DB value exceeds the standard value ??? I hope this explanation aint to confusing :)
  2. gulshesh

    Individual Shipping Prices

    Noone can help me? Can't anyone tell me where to slot in an SQL query and an if/then routine in order to override the standard prices if database saved price exceeds standard pricings ?
  3. gulshesh

    Newsletter products, HTML email

    Well, It worked marvelously for me... I'm designing a Shop for handelds/cellular phones. So a customer can buy a handheld with or without a contract. IF the customer chooses a contract then he receives the contract formular(s) as pdf in his confirmation email... so the following things ive altered: /catalog/checkout_process.php go to -> // lets start with the email confirmation 1st I had to create a function to check IF there's been a contract chosen within the shopping cart: $antrag_count = 0; $send_antrag_array = array(); aprox at line 224, beneath this code line: } else { $attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix within the else { } brackets I've inserted: if($order->products[$i]['attributes'][$j]['option_id'] == '40' && $order->products[$i]['attributes'][$j]['value_id'] != 160) { $send_antrag_array[$antrag_count] = $order->products[$i]['attributes'][$j]['value_id']; $antrag_count++; } In this case option_id = '40' is the ID for that attribute (Simlock contract) and value_id != 160 is the ID for the value of the attribute (160 is 'without contract' and all others therefore are with a contract) later on ive added this code where the email text gets generated: if(count($send_antrag_array) >0) { ... for($i=0; $i<=count($send_antrag_array)-1; $i++) { ... extract pdf url path and name via SQL queries... array_push($pdf_url_array, $antrag_pdf_result['antrag_pdf_url']); array_push($pdf_name_array, $antrag_name_result['products_options_values_name']); } ... } ... if(count($pdf_url_array)>0) { // if there are pdf urls within that array send to MODIFIED function tep_mail_attachment($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, $pdf_url_array, $pdf_name_array); } else { //send to ORIGINAL function tep_mail($order->customer['firstname'] . ' ' . $order->customer['lastname'], $order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS); } Now within /includes/function/general.php copy the tep_mail function, rename it to tep_mail_attachment and alter it accordingly: //// //! Send email WITH the required Tarif-PDFs (text/html) using MIME in the order confirmation mail // This is the central mail function. The SMTP Server should be configured // correct in php.ini // Parameters: // $to_name The name of the recipient, e.g. "Jan Wildeboer" // $to_email_address The eMail address of the recipient, // e.g. jan.wildeboer@gmx.de // $email_subject The subject of the eMail // $email_text The text of the eMail, may contain HTML entities // $from_email_name The name of the sender, e.g. Shop Administration // $from_email_adress The eMail address of the sender, // e.g. info@mytepshop.com // $pdf_url ADDED : The array with the urls to the desired PDFs // $pdf_name ADDED : The array with the names of the desired PDFs function tep_mail_attachment($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $pdf_url, $pdf_name) { if (SEND_EMAILS != 'true') return false; // Instantiate a new mail object $message = new email(array('X-Mailer: osCommerce Mailer')); // Build the text version $text = strip_tags($email_text); if (EMAIL_USE_HTML == 'true') { $message->add_html($email_text, $text); } else { $message->add_text($text); } // ALTERED NEW CODE FOR ADDING ATTACHMENTS: if(count($pdf_url)>0) { //Errorhandling : Only execute IF there's been URL transmitted for($i=0; $i<=count($pdf_url)-1; $i++) { //Errorhandling : IF /catalog/ is within the url string, remove it, and add it afterwards (to ensure consistency) if(stristr($pdf_url[$i], 'catalog/')) $explode_pdf_url_string = explode("catalog/", $pdf_url[$i]); else $explode_pdf_url_string[1] = $pdf_url[$i]; $pdf_file = DIR_FS_CATALOG.$explode_pdf_url_string[1]; //set absollute path to the file using the global DIR_FS_CATALOG variable if(file_exists($pdf_file)) { //Errorhandling : Only execute IF the file really exists $attachment = fread(fopen($pdf_file, "r"), filesize($pdf_file)); $message->add_attachment("$attachment", $pdf_name[$i], "application/pdf"); // ('file', 'name of file', 'content type') } } } // Send message $message->build_message(); $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject); } Notice that the url of the pdf and the name of the contract have been transmitted to the function (as array) It works great for me!
  4. gulshesh


    Ive implemented the script without problems into my ver 2.2 RC 2a... regarding following steps: $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING; and $email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING . "\n" . "\n"; etc... DO NOT delete the 1st sentence, but replace it in the following step... so its a slight error in the readme file... regarding: array('title' => REPORTS_ORDERS, 'link' => tep_href_link(FILENAME_STATS_CUSTOMERS, 'selected_box=reports')))); you are right, it does not exist, looking for reports_orders or filename_stats_customers with a full-text-search-engine tells me it doesn't exist in ANY of the original files, so I just ignored it... AND IT WORKS FINE! do everything else as told, (also updating the SQL DB was without errors) and activate the mod in the admin panel... It works flawlessly... added new customer, couldn't login without activation, activated it, and logged in...