close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

update order

Thread began 5/12/2016 6:40 am by Jamie | Last modified 5/17/2016 1:18 pm by Ray Borduin | 154 views | 8 replies |

Jamie

update order

Hey Ray

Am trying to re-order product results based on the products category.

Have set up a page which displays the product results based on the relevant category id however, I cant get the update order to work

It doesnt update the ProductOrder and it doesnt redirect to itself...

Have attached and any help greatly appreciated

Jamie

Sign in to reply to this post

Ray BorduinWebAssist

This looks overcomplicated... I think you can just use this code in place of lines 51-71:

php:
<?php

if (isset($_POST["UpdateOrder"])) {
    
mysql_select_db($database_PowerCMSConnection$PowerCMSConnection);
    
$OrderArray = array();
    
$start 1;
    while (isset(
$_POST["ProductID_".$start])) {
    
mysql_query("UPDATE products SET ProductOrder = "intval($_POST["ProductOrder_".$start]) ." WHERE ProductID = " intval($_POST["ProductID_".$start]), $PowerCMSConnection) or die(mysql_error());
    
$start++;
    }

?>



You will also have to add that ProductID hidden form to your repeat region... something like:

php:
<input name="ProductID_<?php echo($curOrder); ?>"  value="<?php echo($row_WADAproduct_order['ProductID']); ?>" type="hidden" >



If you want to set up a premier support ticket I can show you how to do drag/drop reordering at some point.

Sign in to reply to this post

Jamie

thanks Ray. Its still not working ( not sure if thats because its still not redirecting to itself?) attached is the updated file EDIT. sorry should have said that it needs to redirect to itself using productorder_results.php?CategoryID=<?php echo($row_WADAproduct_order['CategoryID']); ?>

re the drag to re-order, I would love that at some point :) got a list am building ready for a ticket.

Sign in to reply to this post

Ray BorduinWebAssist

Change the form action to action="" and it should maintain any necessary url parameters.

It looks like it would work to me at this point. I guess you would have to debug where it is going wrong.

Add a die() statement inside the IF to see if it gets to that point. Then die inside the while to see if it gets in there. If it does, then die with the SQL statement you are running and see if it looks correct.

Check your page for the hidden form element and make sure it looks like it is named correctly. There is an issue somewhere but I'm not spotting it. Probably something simple once you figure out where it is.

Make sure you add " ORDER BY ProductOrder" to your main recordset. As it is, you wouldn't be able to tell if the order was updated in the database or not since you aren't changing the order on the page.

Sign in to reply to this post

Jamie

Have checked all those and it all, as you say, *lloks* good but it just isnt setting the order

Sign in to reply to this post

Ray BorduinWebAssist

Did you try debugging? What happens if you update the re-ordering code to:

php:
<?php

echo("on top ");
if (isset(
$_POST["UpdateOrder"])) {
   echo(
"in if ");
    
mysql_select_db($database_PowerCMSConnection$PowerCMSConnection);
    
$start 1;
   
var_dump($_POST);
    while (isset(
$_POST["ProductID_".$start])) {
    
mysql_query("UPDATE products SET ProductOrder = "intval($_POST["ProductOrder_".$start]) ." WHERE ProductID = " intval($_POST["ProductID_".$start]), $PowerCMSConnection) or die(mysql_error());
    die(
"UPDATE products SET ProductOrder = "intval($_POST["ProductOrder_".$start]) ." WHERE ProductID = " intval($_POST["ProductID_".$start]));
    
$start++;
    }
}
?>
Sign in to reply to this post

Jamie

thanks Ray. On top shows fine, but in if doesnt

Sign in to reply to this post

Ray BorduinWebAssist

I think this may be the issue with using <button> tags instead of <input> in your form. This should be fixed in the latest version of databridge but in the mean time you can just replace the file:

webassist/progress_bar/jquery-blockui-formprocessing.js

with the one I have attached.

Attached Files
jquery-blockui-formprocessing.js
Sign in to reply to this post

Jamie

OK Ray will try that. Thanks for all your help and input :)

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...