fabriccut100 Posted October 6, 2008 Posted October 6, 2008 In the upper right hand corner, in gray I had to hard code in the word "Yard" in to the product_info.php file but I need to create a new category which would be sold by the piece is there a way to make that category specific? this is the code snippet I had to change if it helps any, <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?> Yard <?php echo tep_get_products_stock($product_info['products_id']); ?> <?php echo TEXT_QUANTITY ?> </td> Thanks for any help with this
germ Posted October 6, 2008 Posted October 6, 2008 This is one way: <?php $savepath = $cPath; // save state, the next call destroys it $unit_of_measure = ( tep_get_product_path( $product_info['products_id'] ) == 'xx' ) ? 'Piece' : 'Yard'; $cPath = $savepath; // restore state ?> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?> <?php echo $unit_of_measure; ?> <?php echo tep_get_products_stock($product_info['products_id']); ?> <?php echo TEXT_QUANTITY ?> </td> You just need to change the xx in this line: $unit_of_measure = ( tep_get_product_path( $product_info['products_id'] ) == 'xx' ) ? 'Piece' : 'Yard'; to be the category to be sold by the piece. If it's a subcategory it will be in this format: xx_yy Where xx is the category and yy is the subcategory. Confused yet? :unsure: If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
fabriccut100 Posted October 7, 2008 Author Posted October 7, 2008 Thank you so much for you're quick response but yes I am a bit confused about the product id, I have setup a category with sub categories then there are products under them, so when I go into look at a product for just one of the many categories I would like to use this in I see this: product_info.php?cPath=246_247_251&products_id=292 I just don't know exactly how to use it in 'xx' can you please explain Thank you so much for your time, I really appreciate you taking the time. This is one way: <?php $savepath = $cPath; // save state, the next call destroys it $unit_of_measure = ( tep_get_product_path( $product_info['products_id'] ) == 'xx' ) ? 'Piece' : 'Yard'; $cPath = $savepath; // restore state ?> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?> <?php echo $unit_of_measure; ?> <?php echo tep_get_products_stock($product_info['products_id']); ?> <?php echo TEXT_QUANTITY ?> </td> You just need to change the xx in this line: $unit_of_measure = ( tep_get_product_path( $product_info['products_id'] ) == 'xx' ) ? 'Piece' : 'Yard'; to be the category to be sold by the piece. If it's a subcategory it will be in this format: xx_yy Where xx is the category and yy is the subcategory. Confused yet? :unsure:
germ Posted October 7, 2008 Posted October 7, 2008 If this is the URL to a product you want to say "Pieces": product_info.php?cPath=246_247_251&products_id=292 Then replace xx with 246_247_251 becaause that is the category. Does that help some? :unsure: I did a test on my site with this code so I know it will work if you put in the correct category value. ;) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
fabriccut100 Posted October 7, 2008 Author Posted October 7, 2008 Yea I'm trying that now and it doesn't seem to work, it doesn't seem to make any difference I've tried just switching the order between the two and when I do I get Piece but for everything in my cart I don't know? If this is the URL to a product you want to say "Pieces": product_info.php?cPath=246_247_251&products_id=292 Then replace xx with 246_247_251 becaause that is the category. Does that help some? :unsure: I did a test on my site with this code so I know it will work if you put in the correct category value. ;)
LauraDC Posted October 7, 2008 Posted October 7, 2008 I needed a similar feature and did something like this myself. But I found that it was too difficult to maintain. Every time I wanted to add a new category or change categories I needed to have my code changed. It also means you can't mix different types of products in one category which I found out I needed to do after a while. I finally gave up on it and found someone that could make some database changes so I can edit the descriptor with the product information. That solution works well and I don't have to keep making tedious code changes. Just thought I'd mention it since I went through the same thing. L.
germ Posted October 7, 2008 Posted October 7, 2008 I'd agree with that 110% :) If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
fabriccut100 Posted October 8, 2008 Author Posted October 8, 2008 That's great! can you tell me how much you paid for that and do you know who I can contact to have it done Thank you I needed a similar feature and did something like this myself. But I found that it was too difficult to maintain. Every time I wanted to add a new category or change categories I needed to have my code changed. It also means you can't mix different types of products in one category which I found out I needed to do after a while. I finally gave up on it and found someone that could make some database changes so I can edit the descriptor with the product information. That solution works well and I don't have to keep making tedious code changes. Just thought I'd mention it since I went through the same thing. L.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.