1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Post Price 0.1

Discussion in 'Plugins' started by objective, Jul 23, 2010.

  1. valMETNG

    valMETNG Administrator Staff Member Admin

    That won't work with this plugin because the function name is "submit_2_fields" (see line 104) - not "submit_3_fields."
     
  2. UncleDanger

    UncleDanger New Member

    I made another function especially for the price, so my line 104 reads "submit_3_fields"

    I can edit the price just fine, but I can't totally remove the price. When there's nothing in the box, the price doesn't change, but when I enter a different price, it changes to that.
     
  3. valMETNG

    valMETNG Administrator Staff Member Admin

    If you replace line 92 with the following and then update price, what does it print?
    Code:
    if (!isset($h->vars['submitted_data']['submit_price'])) { print "submit price not defined so returning";exit; } else { print "price = 0";exit; }
     
  4. UncleDanger

    UncleDanger New Member

    It prints price = 0
     
  5. valMETNG

    valMETNG Administrator Staff Member Admin

    I see. OK, then please change line 144 in plugins\post_price\post_price.php to:
    Code:
    if (!$h->post->vars['price'] || !$h->cage->post->keyExists('post_price')) { $h->post->vars['price'] = '0.00'; } // default
     
  6. UncleDanger

    UncleDanger New Member

    Then it just displays price=0 again. This is getting confusing, would you mind telling me what lines 92, 94, 144, and 155 should be?

    I do really appreciate the time you're putting in to helping me with this.
     
  7. valMETNG

    valMETNG Administrator Staff Member Admin

    Sorry I wasn't clear. You can now put the lines back to how they were. Here's the file as it should look:
     

    Attached Files:

    UncleDanger likes this.
  8. UncleDanger

    UncleDanger New Member

    Okay, progress. So now I can edit the price to nothing, but when I do it displays as 0.00, when I don't want it to display at all.

    I changed line 104 to

    Code:
        public function submit_3_fields($h)
    As that's how I separated the price function from the others.
     
  9. valMETNG

    valMETNG Administrator Staff Member Admin

    Change line 144 to:
    Code:
    if (!$h->post->vars['price'] || !$h->cage->post->keyExists('post_price')) { $h->post->vars['price'] = 0; } // default
    Alternatively, you could change line 155 to:
    Code:
    if (!$h->post->vars['post_row']->post_price || $h->post->vars['post_row']->post_price == '0.00') { return; }
     
    UncleDanger likes this.
  10. UncleDanger

    UncleDanger New Member

    Absolute winner!

    Changing 144 was what did it.

    Thank you SO much! I'll try to pipe down with the frequency of asking for help from here on out. :D
     
    valMETNG likes this.

Share This Page