Jump to content

doc1355

Members
  • Posts

    67
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location
    Earth, Trying to get to Mars

Recent Profile Visitors

1,105 profile views

doc1355's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

2

Community Answers

  1. Thank you. I got it to work.
  2. I have the following array, I want to sort by Date, from latest to oldest. How can I do that $array = array( 0 => array( 'id' => 5952, 'points' => 15, 'result' => 'W', 'date' => 'Jan. 2, 22', ), 1 => array( 'id' => 5965, 'points' => 6, 'result' => 'L', 'date' => 'Jan. 1, 22', ), );
  3. Thank you for your reply. But I was able to figure this out. The metadata is associated with another object. I used the ID from this object to retrieve the second object and was able to retrieve the metadata there. Thank you again for your help.
  4. No. It returns Stripe\StripeObject Object ( )
  5. When I look in Stripe dashboard, I see the metadata is saved appropriately under the price. But I don't know why it is not showing here, instead it is returning Stripe\StripeObject Object that's what I'm trying to figure out so that I can use that data.
  6. That worked for the line item. I was doing more weird stuff 🤦‍♂️ How about the [metadata]: How can I get the values in there?
  7. I have a stripe session that when I print I get the following: Stripe\LineItem Object ( [id] => li_1JwCsEAy5kUVbSuGjlYtZ6l7 [object] => item [amount_subtotal] => 2599 [amount_total] => 2340 [currency] => usd [description] => 2022 - Season 1 [price] => Stripe\Price Object ( [id] => price_1JwCsEAy5kUVbSuGHcfoxDhg [object] => price [active] => [billing_scheme] => per_unit [created] => 1637012278 [currency] => usd [livemode] => [lookup_key] => [metadata] => Stripe\StripeObject Object ( ) [nickname] => [product] => prod_KbPhMZ545KIQ90 [recurring] => [tax_behavior] => unspecified [tiers_mode] => [transform_quantity] => [type] => one_time [unit_amount] => 2599 [unit_amount_decimal] => 2599 ) [quantity] => 1 ) Stripe\LineItem Object ( [id] => li_1JwCsEAy5kUVbSuGDqbrfvRm [object] => item [amount_subtotal] => 2899 [amount_total] => 2608 [currency] => usd [description] => 2022 - Season 2 [price] => Stripe\Price Object ( [id] => price_1JwCsEAy5kUVbSuGW58akYjw [object] => price [active] => [billing_scheme] => per_unit [created] => 1637012278 [currency] => usd [livemode] => [lookup_key] => [metadata] => Stripe\StripeObject Object ( ) [nickname] => [product] => prod_KbPhcd6yq2Mrl6 [recurring] => [tax_behavior] => unspecified [tiers_mode] => [transform_quantity] => [type] => one_time [unit_amount] => 2899 [unit_amount_decimal] => 2899 ) [quantity] => 1 ) I don't know how to get the values from this data, like value of amount_total and ... Also, and more importantly, I need to get the values from [metadata]. There are two metadata information for each price, which I like to get. Thank you,
  8. Great point. Thank you for the hint and the code.
  9. Ok. I figured it out. I used getElementsByClassName instead of ID and it worked.
  10. This is brilliant. Thanks. Now I need to figure out how to get the script to work with the ID, instead of name.
  11. Thank you for your reply. 1- When I change the name of the checkbox to choice[], the javascript doesn't calculate or show the total, but you are correct, I can get all the values of the checkboxes. 2- How can I get the second value (season_id) with the current setup?
  12. I have the following array: $available_seasons = array ( 0 => array ( 'season_id' => 226, 'season_name' => '2022 - Season 1', 'season_price' => '25.99', 'season_start_date' => 'Jan. 1, 2022', 'season_end_date' => 'Mar. 31, 2022', 'prize' => 100, ), 1 => array ( 'season_id' => 227, 'season_name' => '2022 - Season 2', 'season_price' => '28.99', 'season_start_date' => 'Apr. 1, 2022', 'season_end_date' => 'Jun. 30, 2022', 'prize' => 100, ), 2 => array ( 'season_id' => 238, 'season_name' => '2022 - Season 3', 'season_price' => '40.99', 'season_start_date' => 'Jul. 1, 2022', 'season_end_date' => 'Sep. 30, 2022', 'prize' => 230, ), 3 => array ( 'season_id' => 239, 'season_name' => '2022 - Season 4', 'season_price' => '30.65', 'season_start_date' => 'Oct. 1, 2022', 'season_end_date' => 'Dec. 31, 2022', 'prize' => 300, ), ) I'm using the following loop to create the form: echo "<form name='seasonForm' method=\"post\" action='execute.php'>"; foreach ( $available_seasons as $k => $season ) { echo "<input name='choice' class='uk-checkbox' type='checkbox' value='{$season[ 'season_price' ]}' onchange='checkTotal()'/>"; } echo "<button type='submit'>Continue</button>"; I have the following JS to calculate the total price: function checkTotal() { document.seasonForm.total.value = \'\'; var sum = 0; for (i=0;i<document.seasonForm.choice.length;i++) { if (document.seasonForm.choice[i].checked) { sum = sum + (document.seasonForm.choice[i].value *1); } } document.seasonForm.total.value = "Total: $" + sum; } I am showing the total price to my users, before they click on submit. As it is, I am only able to able to get the value of one checkbox, which is season_price in my execute.php. What I need is to pass the all season_id and season_price values of the selected checkboxes to execute.php. I am not sure how to do this. Thank you for your help in advance.
  13. The script is designed so that it can create hundreds of posts at a specific time. Each post is based on a specific criteria, specific custom taxonomy. I don't think WP can do this. Also the script updates the posts based on some other criteria at a certain time.
  14. Each post content is not dynamic. However the function creates many posts at the same time based on some criteria. Old posts will remain visible and accessible.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.