porrier Posted September 19, 2015 Posted September 19, 2015 Hello! After a succesfull checkout the customer receives an email with the ordered product written down and in parenthesis is the productnumber noted. Can someone tell me where this exactly happens? I mean in which file of the checkout-process is this information passed to the order-email? I ask because I leave the productnumber empty and therefore there is nothing to see between the parenthesis in the email. 1 x GreatProduct 909 () = 5.80 € I want to take a value from another databasefield and pass it to that email. Regards Andreas
Jack_mcs Posted September 20, 2015 Posted September 20, 2015 The email is created in the checkout_process.php file. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
porrier Posted September 20, 2015 Author Posted September 20, 2015 The email is created in the checkout_process.php file. The relevant part in checkout_process.php seems to be: $sql_data_array = array('orders_id' => $insert_id,. 'products_id' => tep_get_prid($order->products[$i]['id']),. 'products_model' => $order->products[$i]['model'],. 'products_name' => $order->products[$i]['name'],. 'products_price' => $order->products[$i]['price'],. 'final_price' => $order->products[$i]['final_price'],. 'products_tax' => $order->products[$i]['tax'],. 'products_quantity' => $order->products[$i]['qty']); tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array); whereby the products_model is added from the products tabe. The modelnumber I want to add resides in the other table products_description in the column extra_value3. I don't know how to say "take the value from there" and not from the products_model column of the products table. Any hint appreceated. Regards Andreas
Jack_mcs Posted September 20, 2015 Posted September 20, 2015 The code you want is this $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; You need to add code before that to load the model number from the other table and then replace the relevant part in the above. But this is only for the email, which is what you asked. If you want it to show up in the orders table as the model, then you will need to alter the code that saves the order details. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
porrier Posted September 21, 2015 Author Posted September 21, 2015 The code you want is this $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; You need to add code before that to load the model number from the other table and then replace the relevant part in the above. But this is only for the email, which is what you asked. If you want it to show up in the orders table as the model, then you will need to alter the code that saves the order details. Thanks for that, but I think I am not able to add such code to load the model number from another table, I'm not a programmer. I guess it must be something like tep_db_query("update " . TABLE_PRODUCTS_DESCREPTION . ... and another $sql_data_array = array['extra_value3' => $order->products[$i]['model']); something like that. sigh :( Regards Andreas
Jack_mcs Posted September 21, 2015 Posted September 21, 2015 It would be something like this $db_query = tep_db_query("select extra_value3 from products_description where products_id = (int)$products_id"); $db = tep_db_fetch_array($db_query); $new_model = $db[''extra_value3'']; But this won't work since the variable $products_id isn't defined. You would need to get it from higher up in the page. And if there is more than one product or the product has attributes, the code becomes more involved. So unless someone wants to supply the code here, I think you will need to pay someone to do it for you. Before you do that though, is there a reason to duplicate the code already there? Why not just use the model field for what was meant for? Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
porrier Posted September 22, 2015 Author Posted September 22, 2015 It would be something like this $db_query = tep_db_query("select extra_value3 from products_description where products_id = (int)$products_id"); $db = tep_db_fetch_array($db_query); $new_model = $db[''extra_value3'']; But this won't work since the variable $products_id isn't defined. You would need to get it from higher up in the page. And if there is more than one product or the product has attributes, the code becomes more involved. So unless someone wants to supply the code here, I think you will need to pay someone to do it for you. Before you do that though, is there a reason to duplicate the code already there? Why not just use the model field for what was meant for? It just wanted to move the modelnummber out of the productstitle that shows like GreatProduct 909[CP321234SA] or something like that. I installed Extra_Product_Fields_for_v234 and created a new field ariclenumber, that shows this number in extra_value3. So I leave the original model field empty. With the effect, that I get 1 x GreatProduct 909() in the order email sent to the customer.
Jack_mcs Posted September 22, 2015 Posted September 22, 2015 Oh, that's different. Just change the line I first mentioned to this $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' () = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; Or this if you don't want the parenthesis, which don't serve a purpose after the above change $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
♥bruyndoncx Posted September 22, 2015 Posted September 22, 2015 still, why don't you store articlenumber on the model field ? why do you make it so difficult ? KEEP CALM AND CARRY ON I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support). So if you are still here ? What are you waiting for ?! Find the most frequent unique errors to fix: grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt
porrier Posted September 22, 2015 Author Posted September 22, 2015 Oh, that's different. Just change the line I first mentioned to this $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' () = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; Or this if you don't want the parenthesis, which don't serve a purpose after the above change $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n"; ok, that eliminates the query for the products_model in the predefined place but does not query the according field in the extra_value3 column of the products_descreption table. Andreas
porrier Posted September 22, 2015 Author Posted September 22, 2015 still, why don't you store articlenumber on the model field ? why do you make it so difficult ?You are right somehow, it is just that I don't like that the productsnumber is written after the title of the product in the detailed view.Looking at other stores I see articlenumber, EAN an modelnumber grouped at the end of the descreption or in a table on the right side or somesuch. Andreas
Jack_mcs Posted September 22, 2015 Posted September 22, 2015 I guess I don't understand what you want then. If you don't want the model showing in the email, the last change I provided will do that. If you want to use a different field, which serves no purpose that I can see, you will need to change the code as I mentioned previously. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Recommended Posts
Archived
This topic is now archived and is closed to further replies.