Guest Posted October 16, 2013 Posted October 16, 2013 To see what is happening you will need to log in. Use [email protected] PW tester to log in. Go to http://www.womensbusinessclub.co.uk/account_manage.php?cPath=&pID=44&action=new_product Click on preview. As you can see it jumps back to the home page rather than previewing and going to the database. Any ideas? account_manage.php
burt Posted October 16, 2013 Posted October 16, 2013 Looks like a bunch of really bad code in that file. First glance shows the form action as "new_product_preview" which does nothing more than upload an image... Suggest to go to whoever coded this up for you (I'm assuming it's custom coded) and get them to rewrite it because it's poor.
Guest Posted October 16, 2013 Posted October 16, 2013 Burt, I appreciate that the code is messy but I am trying to learn so I can improve which is why I am asking for help on this site. So if the preview button is only calling an image what code do you suggest should go there to take it to the preview page?
burt Posted October 16, 2013 Posted October 16, 2013 All the other actions have a tep_redirect ... before the break .. new_product_preview does not have.
♥mattjt83 Posted October 16, 2013 Posted October 16, 2013 @@womensbusinessclub @@burt You have a syntax error in your javascript as well: document.forms["new_product"].products_price.value = doRound(netValue, 4); } //<-- that bracket is extra Matt
oscMarket Posted October 16, 2013 Posted October 16, 2013 Beside you use a 2.2 or 2.3 , your code structure indeed looks messy. I encourage you to try code this custom code in several files.Like that you get a better overview for each case. Of course for an expert this is not done, however from a learning perspective this is the best thing to do. It is a project on its own, at the end you will know it better as anyone else.And then you could try to make it all-in-one. I created a similar project for osc 2.4 where users can add products.
Guest Posted October 17, 2013 Posted October 17, 2013 I either need to pay one of you guys to fix it for me or have one of you patiently teach me what I need to know - any suggestions or offers?
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 this is about the 'Customer Add Product' add-on which is build for osc2.2.....most code i have rewrote as it was not usable for 2.3.3.4 (and is working now).... 'let me check later today what i changed on the account_manage.php for the rewiew button (currently at work)......and yes I do agree with Burt and Henry the code is messy.
Guest Posted October 17, 2013 Posted October 17, 2013 Yes Renzo, this is code from the 'Customer Add Product' - anything you can do to help will be greatly appreciated :)
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 try this: find: $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); Directly after add: $cPath = (isset($HTTP_GET_VARS['cPath']) ? $HTTP_GET_VARS['cPath'] : ''); next to that replace all the osCsid with cPath this should do the bit which is returning the preview button and the cancel button to the wrong page, nevertheless, I'm pretty sure you need to do a lot of more tweaking before fully workable
Guest Posted October 17, 2013 Posted October 17, 2013 Renzo, you are a star! That worked but now the only problem is that it is not sending the updated data to the database..... any suggestions for that?
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 Are you sure??......i can remember that it does update the database with the changes (unless you changed any input/selection field naming/etc.), but it came back with a blank screen only showing header. This is as the product_update has no return/redirect handler specified, so just giving blank screen. You can do that, but is moreless a 'fast and dirty' javascript......it's not nice coding, but as you do not want to re-write the whole addon, it is atleast a 'short-time' solution. place the following on row 101 //Added a return message on product insert/update ?> <script type="text/javascript"> location.href = 'account_manage.php' </script> <?php //Added a return message on product insert/update make sure that you do not remove the '}' sign.....
Guest Posted October 17, 2013 Posted October 17, 2013 It's not working. When I add text to the description it does not pull through to the preview page.
Guest Posted October 17, 2013 Posted October 17, 2013 also I get this when I hit the back button: Warning: trim() expects parameter 1 to be string, array given in /home/womensbu/public_html/includes/functions/general.php on line 57
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 just to check , are you using osc version 2.3.3.4 ?? I have included your file, with the changed I proposed....please check with this one... account_manage.php
Guest Posted October 17, 2013 Posted October 17, 2013 I am using v2.3.3.3 I tried the file you sent and got this error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 = '', products_tax_class_id = '', customer_id = '3', manufacturers_id = '', pr' at line 1 update products set products_quantity = '', products_model = '', products_price = '', products_date_available = null, products_weight = '', products_status = '1', 0 = '', products_tax_class_id = '', customer_id = '3', manufacturers_id = '', products_last_modified = now() where products_id = '0'
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 OK. Could you resent the 'working' one again (the one which gives 'general.php on line 57' error)....I will compare it with what i have....
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 could you change line 384 from: <td class="main" ><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_textarea_field('products_description','soft', '70', '10', $pInfo->products_description); ?></td> to: <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '20', '10', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td> and tell what happends with the discription when you hit preview?
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 also on line 693 I see the following: if ($action != 'new_product_preview') { however I have: if ($action == 'new_product') {
Guest Posted October 17, 2013 Posted October 17, 2013 I tried the change in line 384 and didn't see any change.
renzo.verschoor Posted October 17, 2013 Posted October 17, 2013 The stange thing i saw when i checked your website was that the second digit of anything what you type in the discription Field is being previewed when pressing the preview button. I need to leave so cannot try to solve this for you today, but i will try making a new working file for you tomorrow....
renzo.verschoor Posted October 18, 2013 Posted October 18, 2013 could you try this one and see what kind of error is coming back? account_manage.php
Guest Posted October 18, 2013 Posted October 18, 2013 I uploaded that one and the following happened: When I put text in the text field it did not go through to preview or to the database. When I clicked the back button I got this error: Warning: trim() expects parameter 1 to be string, array given in /home/womensbu/public_html/includes/functions/general.php on line 57
Recommended Posts
Archived
This topic is now archived and is closed to further replies.