Forums  ›  General  ›  General discussions
 

Views missing from Ads module

This has been added to the ads module and will be in the upcoming 1.2.0 beta.

Here is the procedure to add views to the Ads module.

Edit ChAdsModule.php

find $sTimeAgo = defineTimeInterval($aSqlResStr['DateTime_UTS'], false);

under that line add:

$iViews = (int)$aSqlResStr[Views];

find $aSubjVariables      = array(

under 'date_ago'    => $sTimeAgo, add the following:

'views'     => $iViews,

find the line $sSubjectSectContent = $this->_oTemplate->parseHtmlByName('entry_view_block_info.html', $aSubjVariables);

change entry_view_block_info.html to ads_info_block.html

Create a new file ads_info_block.html in the /template directory of the Ads module and place the following in the file.

<div class="ch_sys_block_info">

    <div class="infoMain">

        __author_unit__

        <div class="infoText ch-def-margin-sec-top">

            <div class="infoUnit infoUnitFontIcon">

                <i class="sys-icon clock-o"></i>

                __date__ (__date_ago__)

            </div>

            <div class="infoUnit infoUnitFontIcon">

                <i class="sys-icon folder"></i>

                __cats__

            </div>

            <div class="infoUnit infoUnitFontIcon">

                <i class="sys-icon tags"></i>

                __tags__

            </div>

        <div class="infoUnit infoUnitFontIcon">

                <i class="sys-icon eye"></i>

                __views__

            </div>

        </div>

        <div class="clear_both"></div>

    </div>

</div>

__fields__

The reason for creating the new template file is to separate out the Ads module from the other modules that use the same info block.

 

I had a client ask me about "views" in the Ads module.  Looking through the code I see there is a "Views" column in the ch_ads_main table and the code is in place in the module to track views for an advert.  What is missing is a key to display the number of views an advert has received.  The number views can be an important feedback to members that post an advert, letting them know if there is interest or if perhaps rewording the advert could bring more attention.

On a side note, I think some of the modules have too many blocks on the page.  For example, on the site I am working with, the advert block has a "Custom Values" block with country and city.  I would think this would be a part of the info block.

Yes that is a very important feature, i was wanting that as well.

I had a client ask me about "views" in the Ads module.  Looking through the code I see there is a "Views" column in the ch_ads_main table and the code is in place in the module to track views for an advert.  What is missing is a key to display the number of views an advert has received.  The number views can be an important feedback to members that post an advert, letting them know if there is interest or if perhaps rewording the advert could bring more attention.

On a side note, I think some of the modules have too many blocks on the page.  For example, on the site I am working with, the advert block has a "Custom Values" block with country and city.  I would think this would be a part of the info block.