Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Preview button jumping to index


Guest

Recommended Posts

Posted

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.

Posted

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?

Posted

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.

Posted

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?

Posted

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.

Posted

Yes Renzo, this is code from the 'Customer Add Product' - anything you can do to help will be greatly appreciated :)

Posted

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

Posted

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?

Posted

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.....

Posted

It's not working. When I add text to the description it does not pull through to the preview page.

Posted

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

Posted

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'

Posted

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....

Posted

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?

Posted

I tried the change in line 384 and didn't see any change.

Posted

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....

Posted

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...