I can display random ads from a group, I'm using the php code inside a block. But is there a way to display certain ids of ads in a determined ordered list something like array('ordernids' => '69,76,43,122')
That would be useful to me.. because I need to organize the ads in a specific order the admin sets. I can call multiple php calls

print ad(0, 1, array('nids' => '69'));
print ad(0, 1, array('nids' => '76'));
....

but this is veeery slow
it would be nice to do it in one php call.
Thanks

Comments

hedac’s picture

I want to put more expensive ads at the top of the cheaper ones.

I'm looking at the code adserve.inc
and it seems more complicated than I thought... it always uses the RAND() function in mysql.... I don't know how to implement an array of ids in a specific order... :/

hedac’s picture

Category: support » feature

ok.. I don't have the skills to do it... so I put it in "feature requests"

Ideal would be.. an interface to configure how ads are displayed... Options: Random, By date, or manual order by some kind of weight parameter for each ad.

Boletus’s picture

I agree. Some kind of weight parameter would be great!

hedac’s picture

yes...
it would be nice to add a field in the Ads list after the edit button for example.. and a submit button to reorder all the weights at once... and a check box below to activate / deactivate random order.

weight could be stored in another table to not touch the ads database.

a drag and drop interface as in drupal 6 is perfect but maybe too much to start :)

jeremy’s picture

There are hooks to allow the implementation of add-on modules defining custom ad-weight logic. Take a look in the weight/percent directory for an example. Unfortunately that add-on was never completed, so some hooks may still be missing in core. Regardless, if this is ever to be supported, it will be supported through an add-on. Contributions welcome.

hanskuiters’s picture

Would be nice to have the random setting as an extra parameter in de print ad() function. So when you have more than one ad-area on your page, you can specify the random setting per ad-area.

jeremy’s picture

Status: Active » Postponed

Postponing until someone comes along with a patch.

hedac’s picture

sorry to reply without a patch... but I would like to ask..
if would it be easier to use the Views integration "sort criteria" using the update date of node as a sort method for example.. it would do the trick because you can change the date of a node and then you can assign dates acording to the order you want of the ads.

Thanks

hedac’s picture

ok here is a little workaround

I have added a column in the ads mysql table which is "amount" (the amount of $ of each ad paid)

So to sort the list of nids by amount of $ paid in descending order... instead of random ads you have to replace line 86 of adserve.inc with:
$sql = "SELECT aid, adtype, redirect, activated, maxviews, maxclicks, amount FROM {ads} WHERE adstatus = 'active' $filter $filter2 ORDER BY 'amount' DESC LIMIT ". adserve_variable('quantity');

it's a start.. I have to enter the amount manually in the mysql table for now.
:)

awolfey’s picture

I think you could also have just one advertisement per group. Then name the groups something like "01-Right", "02-Right" and so on. Then don't assign a weight to the groups, so the weight is 0 for all groups. The groups with then be sorted alphabetically. Assign the ads to the groups in the order you want.

This may not be practical in every case, and it does require some extra work, especially if you want to put a new ad at the top of the list, but it may be a temporary solution.

I suppose doing it this way you could also just rename the groups to change the order. Not sure if that would mean having to re-place the groups in the right region....

geshan’s picture

I also thought of adding something like it say weigh and editing it manually form PHPmyadmin but that would be a problem. I don't know how to get the values from a form as I'm not into module coding till now. So what I did was :
$sql = "SELECT aid, adtype, redirect, activated, maxviews, maxclicks, amount FROM {ads} WHERE adstatus = 'active' $filter $filter2 ORDER BY 'aid' DESC LIMIT ". adserve_variable('quantity');

So that the latest ads appear first. If anyone finds or develops a patch do post here :-).

awolfey’s picture

The method I described in #10 didn't work. I think the blocks module(?) didn't sort the groups the way I expected, so I gave the groups' blocks weight to order them. This will be inconvenient for my client when they have to add a new ad to the top of the list, but it works. I suspect I'll end up doing it.

jeremy’s picture

Version: 5.x-1.4-1 » 6.x-2.x-dev

Moving to the latest development branch, still awaiting patches or funding.

warriory2k’s picture

This option should have been implemented already!!! +100
I have added some number of ads in one ad group, and... oops, found out, that one of them was not displayed in the right order... and how do I suppose to move it UP or DOWN in the list of ads for the current group? This is a very important feature, to be able to order ads. I guess, the problem lies in that, ads can belong to more than one group... Then there must be an option to specify ads order for each group in ad-groups section...

Thank you.

sandorczettner’s picture

You can use views to arrange contents. Create a views block and put it to change the default ad block.

eric.chenchao’s picture

@zoner ad_views can do that but if we want use remote ad, that doesn't help. Hope there is new future to control if display random or in order in the container setting page. Thanks.

deanflory’s picture

I myself just came across this issue where I've found no way to order ads using the Advertisements module and Views. I've tried Nodequeue and DraggableViews and when the view is based on Advertisements a user is not provided the options in views to use those together (but a custom node type would easily). I find it extremely odd that the most basic requirement of ordering an ad lineup is not possible. I'm now days in the hole because of this and since I'm not agile enough to code some custom add-on module as suggested I'm now going to have to rebuild all of these HTML Ads as a custom node type. This issue along with the inability to track clicks on HTML Ads has made the advertisements module fairly useless for my needs. I even tried adding a custom textfield where I could drop in numbers for ordering but when the view is set for Advertisements, a user is unable to choose that for ordering in Views. *sigh*

ericpai’s picture

You need to tell the view to have a relation from Advertisement to Node (Ad: Aid). Do this by going to Relationships and adding a relationship based upon "Ad: Aid". You'll then see under Fields all of the Node fields such as Title and Body available. Then add another relationship "(Node) Nodequeue: Queue".

Branndon’s picture

I'd like to piggyback on this rather than create a new issue. I think it's the same issue anyway.

What I'd like is to display the ads in the order they were added. I don't care about an ordering system, I just want to serve one ad, then when the page reloads, the next ad shows, and so on. Not a random order.

Let me try and be more clear, I'd like to output the ads by AId for example. So if my first ad is AID 100, and my last ad is AID 127, It'd like it to start on any number between 100 and 127. Then after that ad is served, let's take ad 110 for this example, I'd like add 111 to be the next ad served, then once that one is served, ad 112 is served. Once it hits 127 it loops back to AID 100.

Is this easily doable?

ressa’s picture

Is it possible by making minor changes to the module, to sort by for example post date, which can be changed from ad to ad, and thereby control the order of ads?

hexen’s picture

sub

ad views helped me to order this, but since views 3, and new beta of ad_views i can do nothing, and noone helps, so please - provide some path for order. My site is offline since ad_views r fucked up :)

hexen’s picture

Will someone finally provide patch for this, or implement this function? I want to sort my ads too, and actually my site is offline for 5 days because ad_views that im used for sorting is not more compatible (i upgraded to views 3). Please...

hanskuiters’s picture

How can one module break your site? Just turn the module of.

If you need a fast solution, you could hire some paid developer. This is a open source community, with a lot of dedicated developers who use their spare time to contribute. You can't just order a patch.

hexen’s picture

No, i can't order a patch because I'm working for my university, and they don't care about my project more than sharing server with me.

This module doesn't brbreak my site in this meaning. I just don't have any ads, and ads were 1/4 of content on a site. This just -doesn't look good-

lrwebks’s picture

Issue summary: View changes
Status: Postponed » Closed (outdated)

Drupal 6 is EOL and no longer supported. Closing this as outdated for that reason. Thanks for your contribution!