Guest Posted October 23, 2008 Posted October 23, 2008 I (thought I) was following instructions in the Knowledge Base to add a quantity button to a Product Page and somehow when I altered the code it: A) did not add a quantity box and B) removed the Add to Cart button. I tried restoring the code to its original format but I obviously am missing something. Can anyone tell me how to fix the AtoC and also how to add a quantity field or drop down menu below the item attribute menu on the product page? I also want to switch the item photo to the left side and the info to the right, just like it is in the category listing. Any ideas? Thanks!
Guest Posted October 23, 2008 Posted October 23, 2008 Are you talking about this one? Add Quantity Box If so let me first commend you on finding that and trying it yourself. Far too few people are willing to take that extra step. One problem with the knowledge base though is it is for the osc 3 series. Not the one we all have. The first thing you should do is get a clean copy of product_info.php. The next thing is to put those instructions in rc2 format. In product_info.php find <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> Change to <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><input type="text" name="quantity" value="1" maxlength="2" size="2"></td> In includes/application_top find $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); Change to $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']); As always please make sure to backup your files first.
Guest Posted October 23, 2008 Posted October 23, 2008 Are you talking about this one? Add Quantity Box If so let me first commend you on finding that and trying it yourself. Far too few people are willing to take that extra step. One problem with the knowledge base though is it is for the osc 3 series. Not the one we all have. The first thing you should do is get a clean copy of product_info.php. The next thing is to put those instructions in rc2 format. In product_info.php find <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> Change to <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?><input type="text" name="quantity" value="1" maxlength="2" size="2"></td> In includes/application_top find $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); Change to $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']); As always please make sure to backup your files first.
Guest Posted October 23, 2008 Posted October 23, 2008 Not sure about your last post. Was there something else you needed help with?
Guest Posted October 23, 2008 Posted October 23, 2008 Sorry, I hit the Reply" button instead of just Reply and then thought I cancelled but I guess I posted. Yeah, I probably shouldn't be delving into code. But the GOOD news is... it worked! I now have everything I need on the page and just have to figure out how to move them where I want them. You'll probably hear from me again pretty soon. Thank you so much!
Guest Posted October 23, 2008 Posted October 23, 2008 But the GOOD news is... it worked! I now have everything I need on the page and just have to figure out how to move them where I want them. You'll probably hear from me again pretty soon. Glad it worked out ok. Thats what this forum is for. If you get stuck just come here. There are plenty of people who will offer their help.
Guest Posted October 27, 2008 Posted October 27, 2008 Well I'm back and confused. I was just testing the quantity feature as we discussed previously and there seems to be a problem. I'm not sure if it occurred right after install or if I have since made some weird accidental modification that's causing it. When I type in a quantity "1" then go to my cart it says quantity "36". When I type in "2" the cart says "37". Then, even weirder, when I enter "3" the cart says "34". Can you think where this would be coming from? I don't even know where to start.
Guest Posted October 27, 2008 Posted October 27, 2008 Well I'm back and confused. I was just testing the quantity feature as we discussed previously and there seems to be a problem. I'm not sure if it occurred right after install or if I have since made some weird accidental modification that's causing it. When I type in a quantity "1" then go to my cart it says quantity "36". When I type in "2" the cart says "37". Then, even weirder, when I enter "3" the cart says "34". Can you think where this would be coming from? I don't even know where to start. Hey Sheri, I screwed up. Sorry about that. In catalog/includes/application_top.php find this $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']); Change to $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']); We were passing the products_id number as the value of the quantity instead of the quantity itself. If you notice the quantity added in your shopping cart was the same as the products_id. Sorry about that. Brian
Guest Posted October 27, 2008 Posted October 27, 2008 Ah, that makes total sense, unfortunately it didn't solve the problem. Here's more of that portion of application_top: / customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Do you see anything there I need to change?
Guest Posted October 27, 2008 Posted October 27, 2008 Weel thats strange. I just put that up on my test site and it works perfectly. When you made the change to application_top.php, did you save it and then upload? If so try this but make sure you have a backup copy first. Delete application_top.php from your webserver and then upload it again. Make sure the new change is in there. If you want to see it work let me know and I can pm you my test site address.
Guest Posted October 27, 2008 Posted October 27, 2008 Success! It didn't work when I deleted and re-uploaded, made changes and saved through the osc admin, but when I did it in Dreamweaver it worked. I would do more through Dreamweaver but I read somewhere that they didn't always work well together. Do you know anything about that? It is certainly easier to find and make changes in DW than the online admin. Thanks for your help... again.
Guest Posted October 27, 2008 Posted October 27, 2008 It is certainly easier to find and make changes in DW than the online admin. Thanks for your help... again. Don't ever use the osc admin to modify your files. It can cause a lot of problems that you don't want. Plus it is a security risk. You should just remove file_manager.php from your site. I myself use dreamwaver. The only thing is you have to upload the page to see the changes. Thats why I have a testing site. I can do all of my updates and contribs on there to make sure everything works and then take it to the live site.
Guest Posted October 27, 2008 Posted October 27, 2008 I have been wondering because it's such a pain to use the osc admin. Can I set up my own testing site easily? Then do I just remove the osc folders from my server? That would make so much more sense. Would I still use the osc for uploading products, etc?
Guest Posted October 27, 2008 Posted October 27, 2008 Is what I do is I have my live site in the root, eg: mysite.com. My testing site is in its own directory, eg: mysite.com/test_site. I have a duplicate database for the test site as well. On my pc I have a copy of all the files for my love store in ome folder and the same files in another folder for my test site. It is those files that I use to add contribs and modifications to. Uploading those to the test site on the server. When and only when everything is working os do I add those files to the live site, both on the server and the pc. This way your live store is never affected by any mistakes or a contrib not working. Plus you always have a backup of the working files. Hope that makes sense.
Guest Posted October 29, 2008 Posted October 29, 2008 Okay, here's what I've got now: I have a live site running at triosgallery.com. The osc catalog folder is within the root folder I guess, so when you go to triosgallery.com/catalog it is live. I made a new folder called test in the root folder and copied all osc files into it and uploaded that folder. If you go to triosgallery.com/test/catalog/ my shopping site is there with a warning at the top: "Warning: I am able to write to the configuration file: /var/www/html/test/catalog/includes/configure.php. This is a potential security risk - please set the right user permissions on this file." If you need to see it to believe it, http://www.triosgallery.com/test/catalog/ Can you help me set the right permissions? Sorry, I feel like I'm abusing you but you're just so nice and helpful! hope you don't mind all the questions.
Guest Posted October 29, 2008 Posted October 29, 2008 When you log into your web hosts control panel there should be a link called file manage or something simalar. Click on that. That should bring up your directories. Navigate to the catalog/includes/configure.php. Select it and look for chmod. You want to set the permissions to 644(rw-r-r). If that doesn't work try 444(r-r-r). If you can't find the way to chmod you will have to ask your web host. They will be able to help you with that.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.