Closed Thread
Results 1 to 1 of 1

Thread: How Do I Just Get The Newest Products To Be Shown?

  1. #1
    byronwells is offline Learning Programmer
    Join Date
    Dec 2009
    Posts
    58
    Rep Power
    0

    How Do I Just Get The Newest Products To Be Shown?

    Alright guys

    I am in a little bit of confusion at the moment.. I am using a membership script called simplememberpro and have created a new php page called newest, please see here Untitled Document

    What I am trying to do on that page is to get the products that I are linked to the newest category that we have added to the site.

    So for example I have created a category called mar 2010 with two products in. Those will apear under the newest product link on that page.. Then when I add another category at the end of this month called apr 2010 with two products.. It will automatically change over

    Code:
    <?php
    include_once ("header.php");
    $cat $_GET["cat"];
    $link $_GET["category"];
    $search $_GET["search"];
    $cat_title str_replace("_"," ",$link);

    if(
    $cat != "t")
        {
        
    $GetFile file("http://www.digitalresellersvault.com/template/template.php");
        
    $Content join(""$GetFile);
        
    $categories=$common->categories($db);
        
    $content=str_replace("{categories}",$categories,$content);    
        
    $Pat "/<{Begin}>(.*?)<{End}>/s";
        
    preg_match($Pat,$Content,$Output);
        
    $SelectedContent $Output[1];
        
    $q "select *,DATE_FORMAT(product_date, '%m-%d-%Y') as date from
        "
    .$prefix."products where show_product = '1' ORDER BY Rand() LIMIT 1";
        
        
    $r $db->get_a_line($q);
        
    $id $r[id];
        
    $imageurl $r[imageurl];
        
    $prod_description $r[prod_description];
        
    $salesprice $r[price];
        
    $product_name $r[product_name];
        
    $salespage_link='<a href="prods.php?pid='.$id.'">Click Here For More Information</a>';
        
    $product_name='<a href="prods.php?pid='.$id.'">'.$product_name.'</a>';            
        
    $prod_image='<a href="prods.php?pid='.$id.'"><img src="http://forum.codecall.net/images/'.$imageurl.'"></a>';        
        
    $Content preg_replace($Pat,$ToReplace,$Content);
        
    $Content preg_replace("/{{(.*?)}}/e""$$1"$Content);
        echo 
    $Content;
        include_once (
    "footer.php");        
        exit();        
        }


    elseif(
    $cat == "t")
        {
        
    $search $_GET["search"];
        
    $link $_GET["category"];
        
    $cat_title str_replace("_"," ",$link);
        
    $GetFile file("http://www.digitalresellersvault.com/template/template.php");
        
    $Content join(""$GetFile);
        
    $categories=$common->categories($db);
        
    $content=str_replace("{categories}",$categories,$content);    
        
    $theselect=$common->category_select($db'select');
        
    $Content str_replace("{{category_select}}"$theselect$Content);
        
    $Pat "/<{Begin}>(.*?)<{End}>/s";
        
    preg_match($Pat,$Content,$Output);
        
    $SelectedContent $Output[1];
        
        if(
    $search_txt != "")
            {
            
    $cond    "where product_name like '%".$search_txt."%' && show_product = '1'";        
            }
        else
            {
            
    $cond    "where category = '$cat_title' && show_product = '1'";
            }

        
    ########## pagination ###########
        
    $q "select count(*) as cnt from ".$prefix."products $cond";
        
    $r $db->get_a_line($q);
        
    $count $r[cnt];
        if(
    $count == "0")
            {
            
    $warning "No Results Found";
            }
        
    $records=10;
        
    $links="marketplace.php?cat=t&category=$category&search_txt=$search_txt&";
        if(
    $page=="")
            {
            
    $page=1;
            }
        
    $start=($page-1)*$records;
        
    $Content=$common->print_page_break3($db,$Content,$count,$records,$links,$page);
        
    ########## pagination ###########

        
    $ChangeColor 1;
        
    $ToReplace "";
        
    $GetProduct $db->get_rsltset("select *,(SELECT
    DATE_FORMAT(product_date, '%b/%d/%Y')) as formatteddate from
    "
    .$prefix."products $cond order by product_date DESC limit $start, $records");
        for(
    $i 0$i count($GetProduct); $i++)
            {
            
    $bgcolor "#FFFFFF";
            @
    extract($GetProduct[$i]);
            if(
    $period3_interval == "D"){$interval "Day(s)";}
            if(
    $period3_interval == "W"){$interval "Week(s)";}
            if(
    $period3_interval == "M"){$interval "Month(s)";}
            if(
    $period3_interval == "Y"){$interval "Year(s)";}
            
            
            
    $product_name='<a href="prods.php?pid='.$id.'">'.$product_name.'</a>';
            

            if(
    $subscription_active == "1")
                {
                
    $salesprice $amount3." every ".$period3_value." ".$interval;
                }
            else
                {
                
    $salesprice $price;
                }    
            
    $prod_image='<a href="prods.php?pid='.$id.'"><img src="http://forum.codecall.net/images/'.$imageurl.'"></a>';    
            
    $download_link='<a href="http://www.digitalresellersvault.com/go/downloads/'.$download_link.'"><img border="0" src="http://www.digitalresellersvault.com/template/images/downloadbutton.jpg" width="104" height="16"></a>';

            
    $salespage_link='<a href="prods.php?pid='.$id.'"><img border="0" src="http://www.digitalresellersvault.com/template/images/moreinfobutton.jpg" width="104" height="16"></a>';
            
    $ToReplace .= preg_replace($Ptn,"$$1",$SelectedContent);
            }
        }    
            
    $Content preg_replace($Pat,$ToReplace,$Content);
    $Content preg_replace("/{{(.*?)}}/e""$$1"$Content);
    echo 
    $Content;
    include_once (
    "footer.php");
    ?>
    Last edited by James.H; 03-06-2010 at 08:13 AM. Reason: Use [php] code tags around your php code

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 07-18-2011, 01:56 AM
  2. Password Shown in special character!!!!
    By desireadil in forum C# Programming
    Replies: 2
    Last Post: 05-31-2011, 07:35 AM
  3. Newest Member
    By FakeOrder in forum Introductions
    Replies: 2
    Last Post: 12-03-2010, 06:44 PM
  4. 4 products, 40% comission for each. Sodevrom products
    By sodevrom in forum Affiliate Marketplace
    Replies: 0
    Last Post: 11-25-2007, 05:47 AM
  5. Welcome to our newest Moderator!
    By Jordan in forum Announcements
    Replies: 17
    Last Post: 12-29-2006, 02:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts