Jump to content
Sign in to follow this  
Chrisj

Setting a minimum price

Recommended Posts

I am using a php web video script (that I didn’t write) which allows Users to purchase videos and allows the video uploader to change the default price (set by Admin). I am trying to get help modifying the script so that an Uploader can’t change the price below the Admins’ default price.

I know some things about this code script - when the Admin sets a video purchase price that number/value appears in the config table under the name: video_play_price (this should be the minimum price).

That same Admin set number also appears in the videos table, under the column videos_play_price, but when the User/Uploader changes the price, the price changes there (in the videos table > videos_play_price column). So, based on all that, I attempted to modify the file, by adding lines 30,31,32. I look forward to hearing about what I need to correct, to try again. Thanks

<?php
if (IS_LOGGED == false) {
    header("Location: " . PT_Link('login'));
    exit();
}
if (empty($_GET['id'])) {
    header("Location: " . PT_Link('login'));
    exit();
}
$id    = PT_Secure($_GET['id']);
$video = $db->where('id', $id)->getOne(T_VIDEOS);
if (empty($video)) {
    header("Location: " . PT_Link('login'));
    exit();
}
if (!PT_IsAdmin()) {
    if (empty($db->where('id', $id)->where('user_id', $user->id)->getValue(T_VIDEOS, 'count(*)'))) {
        header("Location: " . PT_Link('login'));
        exit();
    }
}
$video           = PT_GetVideoByID($video, 0, 0, 0);
$pt->video       = $video;
$pt->page        = 'edit-video';
$pt->title       = $lang->edit_video . ' | ' . $pt->config->title;
$pt->description = $pt->config->description;
$pt->keyword     = $pt->config->keyword;


$min_price=$config[‘video_play_price’]; // in db > config table > video_play_price column is where admin's default price is stored 
$temp_price = $videos[‘video_play_price’]; //in db > videos table > video_play_price column - is where uploader price changes are stored 
if ($temp_price<$min_price) { $temp_price = $min_price; }


$pt->content     = PT_LoadPage('edit-video/content', array(
    'ID' => $video->id,
    'USER_DATA' => $video->owner,
    'THUMBNAIL' => $video->thumbnail,
    'URL' => $video->url,
    'TITLE' => $video->title,
    'DESC' => br2nl($video->edit_description),
    'DESC_2' => $video->markup_description,
    'VIEWS' => $video->views,
    'TIME' => $video->time_ago,
    'TAGS' => $video->tags,
	'video_play_price' => $u_paid_videos->video_play_price,
	'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],1)
));

But, I believe I just need to reflect this minimum price code above where it saves the video price in “video_play_price_user”, which, I believe is this line:

'video_play_price_user' => number_format($video->video_play_price?$video->video_play_price:$config['video_play_price'],1)

Any additional guidance will be welcomed.

 

 

 

 

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • 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.