Customization of Web Auction

A place to discuss and receive support for the Web Auction application.

Customization of Web Auction

Postby ejgonzal » Wed Aug 10, 2011 10:33 pm

Hi Sir Steve,

Created this topic to ask for assistance during my development. Hope its ok

Anyways, wanted to add terms and conditions and stumbled to your reply here: viewtopic.php?t=5078

Is it possible that the checkbox is disabled(default checked in database) during registration so that the check box value is always 1 and cannot be changed?

Sorry forgot about the attributes, solved it by adding
Code: Select all
widget:atts:disabled="disabled"




Just added this line to field.ini for users:
Code: Select all
widget:description = "By completing this form you agree to our Terms and Conditions"


Is it possible that the description is in 2 lines and a html link?

i.e.:
Code: Select all
By completing this form you agree to our Terms and Conditions.
Click here to read the Terms and Conditions(<<hyperlink?)
     






Thanks,

Edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby shannah » Fri Aug 12, 2011 11:54 am

I think the widget:description directive is just inserted raw. I.e. you can include HTML tags like <br/> and <a href="..."> ...</a>

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Customization of Web Auction

Postby ejgonzal » Mon Aug 15, 2011 7:52 am

shannah wrote:I think the widget:description directive is just inserted raw. I.e. you can include HTML tags like <br/> and <a href="..."> ...</a>

-Steve


works perfect and very nice.

btw is it possible that i can disable the bid option for a particular registered user?
like i added a column in the users table named bid_access(1 or 0) where should i create the function and where to call it?
and also how can this column be only visible by admin only?

hope you can help

thanks,
edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby shannah » Mon Aug 15, 2011 12:00 pm

You would need to modify 2 places:

1. templates/view_product.html - And change the if statement that currently says that any logged in user can bid as long as they aren't the current high bidder.
2. tables/bids/bids.php - Currently the "new" permission is granted to all logged in users. You would want to add logic to revoke this permission from users who don't "deserve" it.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Customization of Web Auction

Postby ejgonzal » Tue Aug 16, 2011 11:22 pm

Works great just added the following:

include/functions.inc.php
Code: Select all
function isBidder(){
   $user = getUser();
   return ($user and $user->val('bidder') == 'ALLOWED');
}


templates/view_product.html
Code: Select all
{if !isBidder()}
          <b>Your account is not yet allowed to bid.</b>
      {elseif $product->val('isOpen') and $product->val('high_bidder') != getUsername()}


Now comes the tricky part, I want the column bidder to have the same behavior as the ROLE column.
1. Not visible on register form
2. Users can see in their profile as a label
3. Admin can edit through combo box

i traced the widget but no options for the role and got stuck in PermissionsTool.php instead, is this where i should edit?

Appreciate your help a lot Sir Steve.

Thanks,
Edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby shannah » Thu Aug 18, 2011 9:40 am

You need to set field permissions. Check out the users table delegate class to see how the permissions were set for the role field. (i.e. tables/users/users.php). Look for the role__permissions() method.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Customization of Web Auction

Postby ejgonzal » Fri Aug 19, 2011 4:24 am

haha i'm really enjoy your Application Sir Steve, thanks very much for the constant advice.

Works great now
added the following

tables/users/fields.ini
[bidder]
widget:type=select
widget:label = "Allow Bid (Admin Access Only)"
vocabulary = allowbid


tables/users/valuelists.ini
[allowbid]
Disabled=Disabled
Allowed=Allowed


tables/users/users.php
Code: Select all
   function bidder__default(){
      return 'Disabled';
   }   

   function bidder__permissions(&$record){
      if ( isAdmin() ){
         return null;
      } else {
         return array('edit'=>0, 'view'=>1, 'delete'=>0, 'new'=>0);
      }
   }   



Now i'm working on the template public_product_list to change the layout so no question for now :).

Thanks,

Edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby ejgonzal » Fri Sep 09, 2011 9:05 am

Hi Steve,

been very busy customizing your application, anyway need your help with something.

I created a category Closed Auctions and wanted to know how i can do the following:

1. Category only visible by admin
2. Products under this category is not displayed on All Broducts link


Thanks,

Edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby shannah » Fri Sep 09, 2011 9:37 am

You can use a combination of permissions and security filters for this. It is common to set the security filters in the init() method of the table's delegate class:
http://xataface.com/wiki/init
http://xataface.com/wiki/setSecurityFilters

There's a gotcha though. You might be inclined to set a security filter as follows in the products table delegate class:

Code: Select all
function init(Dataface_Table $table){
    if ( !isAdmin() ){
        $table->setSecurityFilter(array('product_categories'=>'!=8'));  // Assuming the closed category id is 8.
    }
}


This would successfully hide all products in category 8 from regular users. However it would also override legitimate queries for particular categories. E.g. if you click on "All Products" you'd get what you expect. But if you click on any other category in the left menu, you would just see the same thing as "All Products".

So what you actually have to do is create a grafted field for product_categories and do the security filter on that column. That way you can both search on the actual product categories and a filter on the grafted product categories.


In addition to this you should implement permissions to block access to the products:

Code: Select all
function getPermissions($record){
    if ( !isAdmin() and $record ){
        $cats = $record->val('product_categories');
        if ( in_array(8, $cats) ){
            $perms = Dataface_PermissionsTool::NO_ACCESS();
            $perms['list'] = 1;  // If a closed product is first in the list we don't want to block the list action.
            return $perms;
        }
    }
    return null;
}


(Haven't tested this...)

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Customization of Web Auction

Postby ejgonzal » Sun Sep 18, 2011 11:55 pm

Hi Sir Steve,

With regards to closed auctions, we put it on hold.

I need help on the following though:

1. Intro page
- Currently by default it shows all products, is it possible to show an intro page, i mean when they go to domain/auction/index.php it will show an image like Welcome to Company Auction online. If they click all products/category only that is the time it will show the products?

2. Current Record
- Can we remove the Currect Record Text? and display product name only?

3. Show all categories even if there is no products under it? (menu for all categories)

Thanks,

Edric
ejgonzal
 
Posts: 16
Joined: Tue Aug 09, 2011 2:31 am

Re: Customization of Web Auction

Postby bluebedouin » Tue Sep 20, 2011 6:52 am

ejgonzal wrote:Hi Sir Steve,

With regards to closed auctions, we put it on hold.

I need help on the following though:

1. Intro page
- Currently by default it shows all products, is it possible to show an intro page, i mean when they go to domain/auction/index.php it will show an image like Welcome to Company Auction online. If they click all products/category only that is the time it will show the products?

2. Current Record
- Can we remove the Currect Record Text? and display product name only?

3. Show all categories even if there is no products under it? (menu for all categories)

Thanks,

Edric

1.Could you not have a landing page/home page with all the info you need then have a separate link to the auction page?

2.Do you mean like this?
current record.jpg
current record.jpg (15.53 KiB) Viewed 13483 times

product name.jpg
product name.jpg (16.49 KiB) Viewed 13483 times


If so,edit dataface/lang/en.ini (Or whichever language applies)Change [templates.Dataface_Record.LABEL_CURRENT_RECORD = "Current Record"] to [templates.Dataface_Record.LABEL_CURRENT_RECORD = "Product Name"]
If you mean no text at all just delete everything after the =
Only problem with that is that it leaves a colon!
no label.jpg
no label.jpg (20.77 KiB) Viewed 13483 times



3.Haven't sussed that one out yet!
bluebedouin
 
Posts: 8
Joined: Tue Aug 16, 2011 1:12 pm


Return to Web Auction Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved