Jump to content

Chrisj

Members
  • Posts

    531
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Chrisj

  1. Much thanks for your reply. Based on your suggestion, this is displayed (in html page): HELLOTest text Any additional guidance is greatly appreciated
  2. Thanks for your reply. I've now tried this: $text = ''; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'trending text here'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text = 'Latest text here'; } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text = 'Top text here'; } along with this: $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text and the html file page has this: <div class="test">HELLO{{TEXT}}</div> Yet, all that is displayed is: HELLOAny additional guidance is appreciated.
  3. I also have this in the php (I would have edited the last posting, but I don't see where I can): $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text1, 'TEXT2' => $text2
  4. Thanks for your reply got it now. html needed this: <div class="test">HELLO{{TEXT}}</div> now it displays: "HELLO THIS IS A TEST" Much thanks.I am interested in a little more help, if you are so inclined.My initial intention was to display unique text, when each of three pages appears. When if ($page == 'trending')"unique text 1" displays. When if ($page == 'latest') than "unique text 2" displays, and when if ($page == 'top') than "unique text 3" displays. But, then I got that undefined variable error. Now, I'm trying to have the unique texts display again.I just tried this: $text1 = 'THIS IS A TEST'; $text2 = 'THIS IS TEST 2'; $category_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); $text1 = 'TEXT'; } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); $text2 = 'TEXT2'; } and this in the html code: <div class="test">HELLO{{TEXT}}{{TEXT2}}</div> but it shows me this on all three displayed pages:HELLOTHIS IS A TESTTHIS IS TEST 2 Any guidance as to how to display unique text when each unique page is loaded, will be appreciated.
  5. Thanks so much again for your reply. Based on your suggestion, I tried this in the php: $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $category_id, 'TEXT' => $text1 to try to send the value through, and still see the same error. Any guidance into what I have incorrect here is appreciated.
  6. Thanks for your reply. Sorry for the truncated code posting. There is a php file (where I added line 35 and line 39): <?php declare( strict_types=1); // these should be set in PHP.ini error_reporting(-1); // set maximum errors ini_set('display_errors' , 'true'); if (empty($_GET['page'])) { header("Location: " . PT_Link('404')); exit(); } $page = PT_Secure($_GET['page']); $limit = 20; $pt->rss_feed = false; $pt->exp_feed = true; $pages = array( 'trending', 'category', 'latest', 'top' ); if (!in_array($page, $pages)) { header("Location: " . PT_Link('404')); exit(); } if (!empty($_GET['feed']) && $_GET['feed'] == 'rss') { $limit = 50; $pt->rss_feed = true; } $text1 = 'THIS IS A TEST'; $cateogry_id = ''; $videos = array(); if ($page == 'trending') { $text1 = 'trending'; $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'latest') { $title = $lang->latest_videos; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $cateogry = PT_Secure($_GET['id']); $title = $categories[$cateogry]; $cateogry_id = "data-category='$cateogry'"; $db->where('privacy', 0); $videos = $db->where('category_id', $cateogry)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } use Bhaktaraz\RSSGenerator\Item; use Bhaktaraz\RSSGenerator\Feed; use Bhaktaraz\RSSGenerator\Channel; //Export rss feed if ($pt->rss_feed) { $rss_feed_xml = ""; $fl_rss_feed = new Feed(); $fl_rss_channel = new Channel(); $fl_rss_channel ->title($pt->config->title) ->description($pt->config->description) ->url($pt->config->site_url) ->appendTo($fl_rss_feed); if (is_array($videos)) { foreach ($videos as $feed_item_data) { $feed_item_data = PT_GetVideoByID($feed_item_data, 0, 0, 0); $fl_rss_item = new Item(); $fl_rss_item ->title($feed_item_data->title) ->description($feed_item_data->markup_description) ->url($feed_item_data->url) ->pubDate($feed_item_data->time) ->guid($feed_item_data->url,true) ->media(array( 'attr' => 'url', 'ns' => 'thumbnail', 'link' => PT_GetMedia($feed_item_data->org_thumbnail))) ->appendTo($fl_rss_channel); } } header('Content-type: text/rss+xml'); echo($fl_rss_feed); exit(); } $html_videos = ''; if (!empty($videos)) { foreach ($videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $html_videos .= PT_LoadPage('videos/list', array( 'ID' => $video->id, 'VID_ID' => $video->id, 'TITLE' => $video->title, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TIME' => $video->time_ago, 'DURATION' => $video->duration )); } } if (empty($videos)) { $html_videos = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; } $pt->videos_count= count($videos); $pt->page = $page; $pt->title = $title . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = @$pt->config->keyword; $pt->content = PT_LoadPage('videos/content', array( 'TITLE' => $title, 'VIDEOS' => $html_videos, 'TYPE' => $page, 'CATEGORY_ID' => $cateogry_id )); and an html file ( I added line 23): <div class="wo_about_wrapper_parent"> <div class="wo_about_wrapper"> <div class="hero hero-overlay" style="background-color: #033d5d;"> <div class="container"> <h1 class="text-center"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg> {{TITLE}}</h1> </div> </div> <svg id="wave" viewBox="0 0 1440 48" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"><g transform="translate(0.000000, -564.000000)" fill="#033d5d"><g id="Head-background" transform="translate(-168.000000, -346.000000)"><g id="waves-background" transform="translate(888.000000, 934.000000) scale(-1, 1) translate(-888.000000, -934.000000) translate(168.000000, 910.000000)"><path d="M0,14.60779 C101.722445,4.7613277 195.244576,-4.14113188e-14 429,-2.84217094e-14 C732,-1.97619698e-14 798,45.6756592 1089,45.6756592 C1245.83848,45.6756592 1364.64602,29.5028807 1440,14.5904096 C1440,14.60779 1440,48 1440,48 L0,48 C0,48 0.0410082206,34 0,14.60779 Z" id="Path-3-Copy"></path></g></g></g></g></svg> </div> </div> <div class="content pt_shadow pt_page_margin" style="padding-top: 25px;"> <div class="col-md-12"> <div class="upload-head"> <div style="float: right;"> <button class="btn btn-main" data-action="multuple-buy-video" onclick="PT_MultipleBuyVideo();">View all selected</button> </div> <h4><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg></h4> <hr> </div> <div class="test"><font color="#696969" font size="3" face="Arial">HELLO<?php echo $text1;?></font> </div> <div class="videos-latest-list row"> {{VIDEOS}} </div> <?php if ($pt->videos_count > 1) { ?> <div class="watch-video-show-more desc load-more" data-type="{{TYPE}}" {{CATEGORY_ID}}> {{LANG show_more}} </div> <?php } ?> <div class="clear"></div> </div> <div class="clear"></div> </div> I am seeing the error on the html page: Notice: Undefined variable: text1 in /home/public_html/themes/videos/content.html on line 23 Any additional guidance to remedy this error is appreciated.
  7. I am trying to display some text "THIS IS A TEST" on the html page. I am getting this error: Notice: Undefined variable: text1 in /home/public_html/themes/videos/content.html on line 23 line 23 is this: <div class="test"><font color="#696969" font size="3" face="Arial">HELLO<?php echo $text1;?></font> The php file, related to the html page shows this (partially): $text1 = "THIS IS A TEST"; $cateogry_id = ''; $videos = array(); if ($page == 'trending') { $title = $lang->trending; $db->where('privacy', 0); $videos = $db->where('time', time() - 172800, '>')->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'latest') { $title = $lang->latest_videos; echo "$text1"; $db->where('privacy', 0); $videos = $db->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'top') { $title = $lang->top_videos; $db->where('privacy', 0); $videos = $db->orderBy('views', 'DESC')->get(T_VIDEOS, $limit); } else if ($page == 'category') { if (!empty($_GET['id'])) { if (in_array($_GET['id'], array_keys($categories))) { $cateogry = PT_Secure($_GET['id']); $title = $categories[$cateogry]; $cateogry_id = "data-category='$cateogry'"; $db->where('privacy', 0); $videos = $db->where('category_id', $cateogry)->orderBy('id', 'DESC')->get(T_VIDEOS, $limit); } else { header("Location: " . PT_Link('404')); exit(); } } } what do I need to correct to remedy the error? Any help is appreciated.
  8. Thanks again for your reply. Yes, I've been reading. I've been given a lot of advice and tried many things without success (including what was provided here and elsewhere). But, some of the explanation I don't understand, like this sentence "use the new wallet and balance amounts in that existing single query, per the comment i added at that point, rather than to start adding more queries before the start of where the transaction/rollback logic starts". Earlier in this thread I was told "Try reading your own code. Go through it line by line and check the value of each variable after each line executes". Based on that, as far as I can see, this should work, but shows 'not enough money: } else { // 4 + 4 >= 6 if ($wallet + $balance >= $amount) { // 8 = 4 + 4 $balance = (string)($balance + $wallet); // 2 = 8 - 6 $balance = (string)($balance - $amount); $wallet= '0'; $db->where('id', $user_id); $update_user_balance = $db->update(T_USERS, [ 'balance' => $balance ]); } } any additional guidance is appreciated
  9. Thanks for your reply. This seems to work successfully, where a purchase uses the amount in ‘wallet’ first, and then uses the amount in ‘balance’ if there is not enough in ‘wallet’: however, if all videos cost 2 (or higher), and there is “1” left in the ‘wallet’, it will never get used. I am looking to see how I can make more like if ‘wallet’ is zero then deduct from ‘earnings’ (or wallet + balance = amount)… I have tried this revision without success: // Check if user has enough wallet amount to purchase video if($wallet >= $amount){ $wallet = (string)($wallet - $amount); $db->where('id', $user_id); $update_wallet = $db->update(T_USERS, [ 'wallet' => $wallet ]); } else { if($wallet < $amount && $wallet + $balance >= $amount){ $wallet = (string)($wallet - $amount) + $balance = (string)($balance - $amount); $db->where('id', $user_id); $update_user_balance = $db->update(T_USERS, [ 'balance' => $balance ]); $db->where('id', $user_id); $update_wallet = $db->update(T_USERS, [ 'wallet' => $wallet ]); } } I’m trying to say this;if what’s in the ‘wallet’ is less than the amount AND $balance has more than or equal to the amount: if($wallet < $amount && $wallet + $balance >= $amount){ then proceed to deduct whatever is left in 'wallet' to satisfy the amount + the rest of the amount from $balance: $wallet = (string)($wallet - $amount) + $balance = (string)($balance - $amount); but, apparently I need to say this better in code: “then proceed to deduct whatever is left in 'wallet' to satisfy the amount + the rest of the amount from $balance” any additional help is greatly appreciated.
  10. Thanks for your reply. Much appreciated. I have tried your suggestion without success. I see a pop-up dialog box that displays: "Something went wrong. Please try again later!!" (from the script.js file): function PT_MultipleBuyVideo() { var checked = getSelectedVideos(); if (!checked) { return false; } swal({ title: "", type: "info", html:"Simply proceed to purchase " + countSelectedVideos() + " video(s) at a total cost of " + countTotalCredits() +" credits", showCancelButton: true, cancelButtonText: "Close", customClass: 'sweetalert-lg', confirmButtonText:'Proceed' }).then(function(){ $.ajax({ url: PT_Ajax_Requests_File() + 'aj/buy-video', type: 'POST', dataType: 'json', data: {id:checked}, }).done(function(data){ if (data.status == 200) { for (var i = 0; i < checked.length; i++) { var button = $("button[data-action='multiple_select_button'][data-id='" + checked[i] + "']") buttonMultipleSelectingStyle(button, 'purchased'); } swal({ title: "Success", type: "success", html:"", showCancelButton: true, cancelButtonText: "Close", customClass: 'sweetalert-lg', confirmButtonText:'Go To Video(s)' }).then(function(){ window.location.href='/paid-list'; }); } else { if (data.error_num == 1) { swal( 'Error!', 'Not enough money(test)', 'error' ); } else { swal( 'Error!', 'Something went wrong. Please try again later!', 'error' ); } } }).fail(function() { swal( 'Error!', 'Something went wrong. Please try again later!!', 'error' ); }) }); } The only thing that shows 'not enough money' from 'wallet' or "success' (when there is enough) is this: if($wallet + $balance >= $amount) { $wallet = (string)($wallet - $amount); //}elseif $wallet = 0; { $balance = ($balance - $amount); $db->startTransaction(); Any other ideas will be appreciated
  11. So, I just tried this without success: Code: if ($wallet >= $amount) { $wallet = (string)($wallet - $amount); } elseif ($wallet + $balance >= $amount) { $balance = (string)($balance - $amount); $db->startTransaction(); etc.... By ‘without success’, I mean that the same message appears as if just the ‘wallet’ doesn’t have enough “Not Enough Money” - when I test - by having 3 in ‘wallet’ and 3 in earnings (equals a total of 6) but try to purchase something that costs 5.Any suggestion, guess or guidance will be appreciated.
  12. The "Something went wrong. Please try again later!!" is in a pop-up dialog box, and comes from the script.js file. Also, when I comment out those additional lines of code, the script gets no error.
  13. In my account 'wallet' I have 3, and in 'balance' I have 3, which equals a total of 6. I tried to purchase a total of 5, with this code added: if($wallet >= $amout) { // take money first from wallet } elseif ($wallet + $balance >= $amout) { // take money first from wallet and/or balance } else { echo json_encode([ 'status' => 400, 'error_num' => 1, 'error' => 'Not enough money' ]); } else { I saw "Something went wrong. Please try again later!!" any additional help is appreciated
  14. Thanks for your reply. I appreciate your time you've taken to explain. It all makes sense. It is a lot for me to implement, although I'm working on it. However, the first step for me, I believe, would be to get help with adding in these things you've commented, please, before I start improving my tables.: // it is here that you would include the balance amount // you would calculate new wallet and balance amounts // you would include the new 'balance' too any guidance, examples of what's needed there, will be greatly helpful.
  15. I have now set-up a separate 'account' table named 'purchases' (see attached image). What should the 'order_id' structure be? Any additional guidance will be appreciated
  16. Thank you for your helpful reply. Much appreciated. I've replaced my original file with your commented code. Much thanks for helping clarify what is going on there, and for the small changes that you made to the (now improved) code. I am still looking for a solution where the script first checks the “wallet” amount, and if empty will then check the “balance” amount, and use a required amount from the balance, and if both are empty, then the “not enough money” appears. This was suggested, but I failed at integrating it into the code: if($wallet->balance() + $balance->balance() >= $amount) { $walletAmount = min($amount, $wallet->balance(); $balanceAmount = ($walletAmount < $amount) ? $amount - $walletAmount : 0; // could then create deduct() methods to extract funds $wallet->deduct($walletAmount); $balance->deduct($balanceAmount); } else { // handle not enough money here } any guidance with that would be very helpful. In regard to an 'account' table, thanks for that great advice. The script currently does have u_paid_videos table, as you can see at: // add data to paid table. Would expanding this table to include more be satisfactory? I've attached a picture of it's structure (all though time_date just shows NULL ). Any additional comments/direction/advice is welcomed.
  17. Thanks so much for your message. Currently, the script just checks the 'wallet' and displays 'not enough money' if no funds are available. As far as 'what have you tried', I'm looking for a suggestion, because I don't know what to try.
  18. I am using a php web video script which allows Users to purchase videos successfully. The purchases are made from the amount available in the Users’ “wallet” (the User can also earn compensation, which gets added to his “balance”.). When there’s not enough available in the “wallet” for the purchase, the script checks and displays a message “not enough money”. I’d like help adding the ability where the script first checks the “wallet” amount, and if empty will then check the “balance” amount, and use a required amount from the balance, and if both are empty, then the “not enough money” appears. Here’s the portion of the code that I believe needs the modification: // get cost video $db->where('name', 'video_play_price'); $db_cost = $db->getOne('config'); $video_cost = (float)$db_cost->value; $count_video = count($id_array); $user_id = $user->id; $wallet = (float)str_replace(',', '', $user->wallet); $amout = 0; foreach ($id_array as $id) { $video_id = (int)PT_Secure($id); // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); $amout += $video->video_play_price?$video->video_play_price:$video_cost; } // $amout = $video_cost * $count_video; $charge = ( $video_cost *0.50 ); if ($wallet >= $amout) { //$new_wallet = (string)($wallet - $amout); $wallet = (string)($wallet - $amout); $db->startTransaction(); $inserted_records = 0; foreach ($id_array as $id) { $video_id = (int)PT_Secure($id); // $uploader_amount = $video_cost - $charge; //100 - 20% = 80 // get video data $video = $db->where('id', $id)->getOne(T_VIDEOS); $video_cost_new = $video->video_play_price?$video->video_play_price:$video_cost; $uploader_amount = ( $video_cost_new *0.50 ); // add data to paid table $insert_buy = $db->insert('u_paid_videos', [ 'id_user' => $user_id, 'id_video' => $video_id, 'session_key' => $_SESSION['session_key'], 'video_play_price' => (string)$video_cost, 'video_title' => $video->title, 'user_id_uploaded' => $video->user_id, ]); if ($insert_buy) { $inserted_records++; } //add wallet users' video $userwallet = $db->where('id', $video->user_id)->getOne(T_USERS); //$videouserwallet = $userwallet->balance+$video_cost; $videouserwallet = $userwallet->balance+$uploader_amount; $db->where('id', $video->user_id); $update_balance = $db->update(T_USERS, [ // 'wallet' => $videouserwallet, 'balance' => number_format($videouserwallet, 1, '.', ''), ]); } $db->where('id', $user_id); //$update_wallet = $db->update(T_USERS, [ $update_wallet = $db->update(T_USERS, [ 'wallet' => $wallet, ]); if (($inserted_records == $count_video) && $update_wallet) { $db->commit(); echo json_encode([ 'status' => 200 ]); exit(); } else { $db->rollback(); echo json_encode([ 'status' => 400, 'error' => 'Buy process error' ]); exit(); } } else { echo json_encode([ 'status' => 400, 'error_num' => 1, 'error' => 'Not enough money' ]); exit(); } } else { echo json_encode([ 'status' => 400, 'error' => 'Bad Request, Invalid or missing parameter' ]); exit();
  19. Thanks again for your message. I have tried this: function countTotalCredits() { var checked = []; $("button[data-action='multiple_select_button][data-selected=1]").closest(".video-wrapper").each(function(i){ if ($(this).attr('data-selected') == 1) { checked.push($(this).attr('data-price } }); } with this: function PT_MultipleBuyVideo() { var checked = getSelectedVideos(); if (!checked) { return false; } swal({ title: "", type: "info", html:"Simply proceed to purchase " + countSelectedVideos() + countTotalCredits() +" videos", showCancelButton: true, cancelButtonText: "Close", customClass: 'sweetalert-lg', confirmButtonText:'Proceed' }).then(function(){ and it shows this (upon proceeding with a purchase of 2 videos costing 2 credits each):"Simply proceed to purchase 20 videos"so, something is not yet correct.I'm looking for something like "Simply proceed to purchase 2 videos at a total cost of 4 credits"any additional help will be appreciated. Thanks again
  20. Thanks for your reply. So, I want to remove this?: return checked;
  21. what type of variable is that checked one. Is it a number?
  22. This is what I have so far: function countTotalCredits() { var checked = []; $("button[data-action='multiple_select_button][data-selected=1]").closest(".video-wrapper").each(function(i){ if ($(this).attr('data-selected') == 1) { checked.push($(this).attr('data-price')); } }); return checked; } I'm not sure what else I need. I looked at this example, but don't know how it would work with the code above: var numbers = [65, 44, 12, 4]; function getSum(total, num) { return total + num; } function myFunction(item) { document.getElementById("demo").innerHTML = numbers.reduce(getSum); } any additional help is appreciated
  23. Thanks so much for your help/guidance. Much appreciated. This is above my skill level, but here's my attempt. Added attribute here: <div class="col-md-3 col-sm-6 no-padding-right-at-all no-padding-mobile-left"> <div class="video-latest-list video-wrapper" data-id="{{ID}}" data-views="{{VIEWS}}" data-price="{{PRICE}}"> <div class="video-thumb"> <img src="{{THUMBNAIL}}" alt="{{TITLE}}"> <div class="video-duration">{{DURATION}}</div> </div> <div class="video-title"> <h4 title="{{TITLE}}">{{TITLE}}</h4> </div> <div class="video-info"> <div style="float:right;"><button class="btn btn-main" data-action="multiple_select_button" data-selected="0" data-id="{{ID}}">View</button></div> <div class="price" data-id="{{ID}}"> {{PRICE}} credits</div> </div> </div> </div> Copied of the countSelectedVideos function, renamed it, etc. function countTotalCredits() { var total = price1 + price2; $("button[data-action='multiple_select_button][data-selected=1]").closest(".video-info").find(".price[data-price]") parseInt($(this).attr('data-price'), 10) }); } any additional instruction will be welcomed
  24. Thanks for your reply. Here's all of it: <div class="content pt_shadow"> <div class="col-md-12"> <div class="upload-head"> <div style="float: right;"> <button class="btn btn-main" data-action="multuple-buy-video" onclick="PT_MultipleBuyVideo();">View all selected</button> </div> <h4><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-search"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg> {{LANG search_results}}: {{KEYWORD}}</h4> <hr> </div> <div class="videos-latest-list row"> {{VIDEOS}} </div> <?php if (count($pt->videos) > 0 && empty($_GET['is_channel'])) { ?> <div class="watch-video-show-more desc load-more" data-type="search" data-keyword="{{KEYWORD}}"> {{LANG show_more}} </div> <?php } ?> <div class="clear"></div> </div> <div class="clear"></div> </div> I believe that corresponds with this php: <?php include('/assets/langs/english.php'); if (empty($_GET['keyword'])) { header("Location: " . PT_Link('login')); exit(); } $keyword = PT_Secure($_GET['keyword']); $category_id = (isset($_GET['category_id'])?$_GET['category_id']:0); $list = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; $list2 = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg></div>'; $final = ''; if ($pt->config->total_videos > 1000000) { if($category_id == 0){ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE MATCH (title) AGAINST ('$keyword') OR tags LIKE '%$keyword%' ORDER BY id ASC LIMIT 20"); }else{ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE category_id=$category_id AND ( MATCH (title) AGAINST ('$keyword') OR tags LIKE '%$keyword%' ) ORDER BY id ASC LIMIT 20"); } } else { if($category_id == 0){ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE title LIKE '%$keyword%' OR tags LIKE '%$keyword%' ORDER BY id ASC LIMIT 20"); }else{ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE category_id=$category_id AND ( title LIKE '%$keyword%' OR tags LIKE '%$keyword%' ) ORDER BY id ASC LIMIT 20"); } } if (!empty($get_videos)) { $len = count($get_videos); foreach ($get_videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $pt->last_video = false; if ($key == $len - 1) { $pt->last_video = true; } $final .= PT_LoadPage('search/list', array( 'ID' => $video->id, 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TITLE' => $video->title, 'DESC' => $video->markup_description, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'TIME' => $video->time_ago, 'DURATION' => $video->duration, 'PRICE' => number_format( $video->video_play_price < $config['video_play_price'] ? $config['video_play_price'] : $video->video_play_price) )); } } if (empty($final)) { $final = $list; } $get_users = $db->rawQuery("SELECT * FROM " . T_USERS . " WHERE ((`username` LIKE '%$keyword%') OR CONCAT( `first_name`, ' ', `last_name` ) LIKE '%$keyword%') ORDER BY id ASC LIMIT 50"); if (!empty($get_users)) { $len = count($get_users); foreach ($get_users as $key => $user) { $user = PT_UserData($user, array('data' => true)); $pt->last_user = false; if ($key == $len - 1) { $pt->last_user = true; } $final2 .= PT_LoadPage('search/user-list', array( 'ID' => $user->id, 'USER_DATA' => $user, )); } } if (empty($final2)) { $final2 = $list2; } $pt->videos = $get_videos; $pt->users = $get_users; $pt->page = 'search'; $pt->title = $lang->search . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = $pt->config->keyword; $pt->content = PT_LoadPage('search/content', array( 'VIDEOS' => $final, 'USERS' => $final2, 'KEYWORD' => $keyword )); Also this: <div class="col-md-3 col-sm-6 no-padding-right-at-all no-padding-mobile-left"> <div class="video-latest-list video-wrapper" data-id="{{ID}}" data-views="{{VIEWS}}"> <div class="video-thumb"> <img src="{{THUMBNAIL}}" alt="{{TITLE}}"> <div class="video-duration">{{DURATION}}</div> </div> <div class="video-title"> <h4 title="{{TITLE}}">{{TITLE}}</h4> </div> <div class="video-info"> <div style="float:right;"><button class="btn btn-main" data-action="multiple_select_button" data-selected="0" data-id="{{ID}}">View</button></div> <div class="price" data-id="{{ID}}"> {{PRICE}} credits</div> </div> </div> </div> which ties in with the javascript, correct? function buttonMultipleBuy(command) { var button = $("button[data-action='multuple-buy-video']"); if (command == 'hide') { button.hide(); } else if (command == 'show') { button.show(); } } buttonMultipleBuy('hide'); $(document).on('click touchstart', "button[data-action='multiple_select_button']", function(){ if ($(this).attr('data-selected') == 1) { // uncheck buttonMultipleSelectingStyle($(this), 'uncheck'); } else { // check buttonMultipleSelectingStyle($(this), 'check'); } if (countSelectedVideos()) { buttonMultipleBuy('show'); } else { buttonMultipleBuy('hide'); } }); function countSelectedVideos() { var checked = 0; $("button[data-action='multiple_select_button']").each(function(i){ if ($(this).attr('data-selected') == 1) { checked++; } }); return checked; } function getSelectedVideos() { var checked = []; $("button[data-action='multiple_select_button']").each(function(i){ if ($(this).attr('data-selected') == 1) { checked.push($(this).attr('data-id')); } }); return checked; } function buttonMultipleSelectingStyle(button, action) { if (action == 'check') { button.attr('data-selected', 1); button.css('backgroundColor', '#FF4500'); button.html('Selected'); } else if (action == 'uncheck') { button.attr('data-selected', 0); button.css('backgroundColor', '#04abf2'); button.html('View'); } else if (action == 'purchased') { button.attr('data-selected', 0); button.css('backgroundColor', '#04abf2'); button.html('Purchased'); button.attr('disabled', 'disabled'); } } any additional help is appreciated
  25. Or this? <?php include('/assets/langs/english.php'); if (empty($_GET['keyword'])) { header("Location: " . PT_Link('login')); exit(); } $keyword = PT_Secure($_GET['keyword']); $category_id = (isset($_GET['category_id'])?$_GET['category_id']:0); $list = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg>' . $lang->no_videos_found_for_now . '</div>'; $list2 = '<div class="text-center no-content-found empty_state"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-video-off"><path d="M16 16v1a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2m5.66 0H14a2 2 0 0 1 2 2v3.34l1 1L23 7v10"></path><line x1="1" y1="1" x2="23" y2="23"></line></svg></div>'; $final = ''; if ($pt->config->total_videos > 1000000) { if($category_id == 0){ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE MATCH (title) AGAINST ('$keyword') OR tags LIKE '%$keyword%' ORDER BY id ASC LIMIT 20"); }else{ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE category_id=$category_id AND ( MATCH (title) AGAINST ('$keyword') OR tags LIKE '%$keyword%' ) ORDER BY id ASC LIMIT 20"); } } else { if($category_id == 0){ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE title LIKE '%$keyword%' OR tags LIKE '%$keyword%' ORDER BY id ASC LIMIT 20"); }else{ $get_videos = $db->rawQuery("SELECT * FROM " . T_VIDEOS . " WHERE category_id=$category_id AND ( title LIKE '%$keyword%' OR tags LIKE '%$keyword%' ) ORDER BY id ASC LIMIT 20"); } } if (!empty($get_videos)) { $len = count($get_videos); foreach ($get_videos as $key => $video) { $video = PT_GetVideoByID($video, 0, 0, 0); $pt->last_video = false; if ($key == $len - 1) { $pt->last_video = true; } $final .= PT_LoadPage('search/list', array( 'ID' => $video->id, 'USER_DATA' => $video->owner, 'THUMBNAIL' => $video->thumbnail, 'URL' => $video->url, 'TITLE' => $video->title, 'DESC' => $video->markup_description, 'VIEWS' => $video->views, 'VIEWS_NUM' => number_format($video->views), 'TIME' => $video->time_ago, 'DURATION' => $video->duration, //'PRICE' => $video->video_play_price, //'PRICE' =>number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],1) 'PRICE' =>number_format($video->video_play_price?$video->video_play_price:$config['video_play_price']) )); } } if (empty($final)) { $final = $list; } $get_users = $db->rawQuery("SELECT * FROM " . T_USERS . " WHERE ((`username` LIKE '%$keyword%') OR CONCAT( `first_name`, ' ', `last_name` ) LIKE '%$keyword%') ORDER BY id ASC LIMIT 50"); if (!empty($get_users)) { $len = count($get_users); foreach ($get_users as $key => $user) { $user = PT_UserData($user, array('data' => true)); $pt->last_user = false; if ($key == $len - 1) { $pt->last_user = true; } $final2 .= PT_LoadPage('search/user-list', array( 'ID' => $user->id, 'USER_DATA' => $user, )); } } if (empty($final2)) { $final2 = $list2; } $pt->videos = $get_videos; $pt->users = $get_users; $pt->page = 'search'; $pt->title = $lang->search . ' | ' . $pt->config->title; $pt->description = $pt->config->description; $pt->keyword = $pt->config->keyword; $pt->content = PT_LoadPage('search/content', array( 'VIDEOS' => $final, 'USERS' => $final2, 'KEYWORD' => $keyword ));
×
×
  • 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.