How to show Sponsored listing on a custom page (like listings page)

Discussion in 'Auto Classifieds Script' started by willylions, May 17, 2016.

  1. willylions

    willylions New Member

    Hi i was wandering how can i make a custom page show only sponsored listings just like listings page, with filters and all sorting tools? I need to create this page to add to Main menu so visitors can view only sponsored listings on that page, any help on how to achieved this it's well received.
  2. olairmarcos

    olairmarcos Member

    Hello, you want to list products, companies, vehicles, homes, links, ...? What type of item?
  3. willylions

    willylions New Member

    Hi, sorry i wasn't specific. Im using the Auto classifieds Script, i was referring to vehicles. The auto script comes with an option to mark listings as sponsored and i would like to show only those listings in a custom page just for them.
  4. olairmarcos

    olairmarcos Member

    Good question, I see that do not have the page (sponsored) in case package.
    Come create a ...
    1 - step:
    Edit file install.xml : in /packages/autos/install.xml

    (add follow line (BOLD) in the file:)

    <page group="autos" url="|PACKAGE|" name="autos_index" menus="main,autos" suburl="autos/models/" fields_item="autos">Car Listings</page>
    <page group="autos" url="|PACKAGE|system/" name="autos_system" filename="system" service="1"><![CDATA[]]></page>
    <page group="autos" url="|PACKAGE|add/" name="autos_add" menus="autos" filename="manage" action="add" parent="autos_view" fields_item="autos">Add Listing</page>
    <page group="autos" url="|PACKAGE|edit/" name="autos_edit" filename="manage" action="edit" parent="autos_view" fields_item="autos">Edit Listing</page>
    <page group="autos" url="|PACKAGE|delete/" name="autos_delete" filename="manage" action="delete" parent="autos_view" service="1">Delete Listing</page>
    <page group="autos" url="profile/autos/" name="autos_index_member" menus="account" nofollow="1" parent="profile" fields_item="autos">My Cars</page>
    <page group="autos" url="|PACKAGE|member/autos/" name="autos_index_user" fields_item="autos">Listings of user :username</page>
    <page group="autos" url="|PACKAGE|featured/" name="autos_index_featured" menus="autos" fields_item="autos">Featured</page>
    <page group="autos" url="|PACKAGE|sponsored/" name="autos_index_sponsored" menus="autos" fields_item="autos">Sponsored</page>
    <page group="autos" url="|PACKAGE|latest/" name="autos_index_latest" menus="autos" fields_item="autos">Recently added</page>
    <page group="autos" url="|PACKAGE|popular/" name="autos_index_popular" menus="autos" fields_item="autos">Popular</page>
    <page group="autos" url="|PACKAGE|random/" name="autos_index_random" menus="autos" fields_item="autos">Random listings</page>
    <page group="autos" url="search/cars/" name="search_autos" filename="search" fields_item="autos">Search</page>
    <page group="autos" url="|PACKAGE|view/" name="autos_view" filename="view" readonly="1" nofollow="1" suburl="autos/models/" fields_item="autos">Car details</page>
    <page group="autos" url="|PACKAGE|models/" name="autos_models" service="1"><![CDATA[]]></page>

    <page group="autos" url="|PACKAGE|services/" name="autos_services" menus="main" filename="services" fields_item="autos_services">Services</page>
    <page group="autos" url="|PACKAGE|service/add/" name="autos_service_add" filename="services" action="add" parent="autos_service_view" fields_item="autos_services">Add service</page>
    <page group="autos" url="|PACKAGE|service/edit/" name="autos_service_edit" filename="services" action="edit" parent="autos_service_view" fields_item="autos_services">Edit service</page>
    <page group="autos" url="|PACKAGE|service/delete/" name="autos_service_delete" filename="services" action="delete" parent="autos_service_view" service="1">Delete service</page>
    <page group="autos" url="|PACKAGE|service/" name="autos_service_view" filename="services" readonly="1" nofollow="1" fields_item="autos_services">Service details</page>
    <page group="autos" url="profile/services/" name="autos_member_services" filename="services" menus="account" nofollow="1" parent="profile" fields_item="autos_services">My Services</page>

    <page group="autos" url="|PACKAGE|parts/" name="autos_parts" menus="main" filename="parts" fields_item="autos_parts">Parts</page>
    <page group="autos" url="|PACKAGE|part/add/" name="autos_part_add" filename="parts" action="add" parent="autos_part_view" fields_item="autos_parts">Add part</page>
    <page group="autos" url="|PACKAGE|part/edit/" name="autos_part_edit" filename="parts" action="edit" parent="autos_part_view" fields_item="autos_parts">Edit part</page>
    <page group="autos" url="|PACKAGE|part/delete/" name="autos_part_delete" filename="parts" action="delete" parent="autos_part_view" service="1">Delete part</page>
    <page group="autos" url="|PACKAGE|part/" name="autos_part_view" filename="parts" readonly="1" nofollow="1" fields_item="autos_parts">Part details</page>
    <page group="autos" url="profile/parts/" name="autos_member_parts" filename="parts" menus="account" nofollow="1" parent="profile" fields_item="autos_parts">My Parts</page>


    This line will create the page and menu item (sponsored)

    2 - step:
    Edit file index.php : /packages/autos/index.php

    (Add follow lines (BOLD) in the file)

    case 'autos_index_featured':
    $model = array('description' => iaLanguage::get('list_of_featured_listings'));
    $listings = $iaAuto->get(array('featured' => 1), $pagination['start'], $pagination['limit'], $_SESSION[iaAuto::SESSION_SORTING_KEY]);


    case 'autos_index_sponsored':
    $model = array('description' => iaLanguage::get('list_of_sponsored_listings'));
    $listings = $iaAuto->get(array('sponsored' => 1), $pagination['start'], $pagination['limit'], $_SESSION[iaAuto::SESSION_SORTING_KEY]);


    case 'autos_index_latest':
    $model = array('description' => iaLanguage::get('list_of_recently_added_listings'));
    $listings = $iaAuto->get(array(), $pagination['start'], $pagination['limit'], array('field' => 'date_added', 'direction' => 'DESC'));

    $iaView->assign('no_sorting', true);


    case 'autos_index_popular':
    $model = array('description' => iaLanguage::get('list_of_popular_listings'));
    $listings = $iaAuto->get(array(), $pagination['start'], $pagination['limit'], array('field' => 'views_num', 'direction' => 'DESC'));

    $iaView->assign('no_sorting', true);


    case 'autos_index_random':
    $model = array('description' => iaLanguage::get('list_of_randomly_selected_listings'));
    $listings = $iaAuto->get(array(), 0, $pagination['limit'], iaDb::FUNCTION_RAND);

    $iaView->assign('no_sorting', true);


    3 - step:
    Uninstall Autos package on the control panel (extensions) and then install again. To reload all files on the site.

    The end.
    The result

    I do not know why they have left the disabled page on Autos package.
    I hope I was helpfull.
    Dayir_A., Greg and Vasily_B. like this.
  5. willylions

    willylions New Member

    Wow thanks a lot, ill get on it. But just before i start one question, if i unistall the script and reinstalled would i lose all the settings and translations i've done so far? will i lose anything? Cause that would be terrible for us to lose everything we've done with this script so far. Thanks again, ill be waiting for a response before doing what you suggest.
  6. olairmarcos

    olairmarcos Member


    Yes, you will delete all records. I will search for a way to enter the page directly in the database.

    Only lose the records of (package Autos default) on the site. The changes in the files will not be affected.
    Last edited by a moderator: May 17, 2016
  7. Vasily_B.

    Vasily_B. Project Manager

    Wow, thanks @olairmarcos
    There is another way to register a new page in the system without a package re-installation. Just increment the version of your package.
    For example 4.0.1 package can be 4.0.2 and once you make this change, you will be able to upgrade the package in admin dashboard. In this case it will add all missing pages, hooks, blocks, etc. without content loss.

    Thanks again!
  8. willylions

    willylions New Member

    Thanks Vasily but how do i increment the version of the package without loosing any setting or info? Do you mean update the auto-script? wouldn't i lose settings upgrading the script?
  9. olairmarcos

    olairmarcos Member

    Hello, school I came back, I study a little .... hi.

    So let the changes directly in the database where the pages are stored.

    Step 1
    Create a new page according to the figure below.
    Now we have the new page created within the database in subrion. See the figure below.

    Step 2
    Let's change the properties of the new page directly in the database.

    Access the DB Tolls panel.

    In the BD tools adminer,
    1- Select table
    2- Edit

    Step 3
    Change the table data. See the figure below.

    Save table

    See the new page created in Autos with new properties added.

    Step 4
    Let's have a coffee.

    The result.


    Warning: Make changes to the test site to make sure it is working properly, only then make the change on the main site.

    Thanks for listening.
  10. willylions

    willylions New Member

    Hi olairmarcos, thanks again for your help. I tried your solution but it didn't worked for me on my site. it did created the page but the page does not show any listing on my remote site and on the local test site. Dont know why. Tried couple of time and nothing.
  11. olairmarcos

    olairmarcos Member

    I realized again all the steps proposed above, it worked perfectly on my website.

    See well:

    1 - Add the code above in the file:

    /packages/autos/index.php (required)
    Install.xml (optional)

    2 - Create new page in subrion panel? See the image.
    3 - Make the necessary changes on the new page (autos_index_sponsored) within the database? see the image above.

    4 - Edit item sponsored, to appear on page Sponsored Car
    Performing as described above is not necessary to uninstall and reinstall the package Autos.

    God job.
    Last edited: May 18, 2016
  12. willylions

    willylions New Member

    Yup That did the trick, was missing the first step, edit this file /packages/autos/index.php as you suggested and now it works perfectly. Thanks a LOT bro!

    Attached Files:

  13. olairmarcos

    olairmarcos Member

    It was very good .... success.
  14. Greg

    Greg Super Moderator

  15. Vasily_B.

    Vasily_B. Project Manager

    Yes, you can simply edit the version of autos package in the install.xml file. If you have 4.0.2 for example you can set the package version to and perform an upgrade in admin dashboard / extensions / package. Upgrade process will register a new page for you. you won't lose anything.

    Anyhow, it's recommended to make DB backup before you run the upgrade process.

    @olairmarcos See the version upgrade trick, it indeed helps and sometimes save a couple of minutes
  16. olairmarcos

    olairmarcos Member

    Thanks for the tip. I even thought about it, not me I proposed to do, thinking that might hinder future versions of Autos package. Good work everyone.

    A doubt:
    If I change my version of the package Autos 4.0.2 to and is eventually released a version (bugfix) It can happen a version conflict? As the package version numbers are processed?
    Last edited by a moderator: May 19, 2016
  17. Vasily_B.

    Vasily_B. Project Manager

    No worries. We only version packages as X.X.X, and we never release minor patches as X.X.X.xx so you can apply your fixes and change your version. When we release X.X.Y for example you can simply migrate your added data and patch will be applied correctly without any collision with the new version changes :)
    4.0.3 is higher than and system understands this!

    Dayir_A. and Andrew_G. like this.
  18. Greg

    Greg Super Moderator

    Hi @Vasily_B.

    There was a recent patch to - But you say:
    So now I'm a bit confused. Or am I misunderstanding, again?
    Dayir_A. likes this.
  19. Andrew_G.

    Andrew_G. Staff Member

    Hello @Greg,
    Recently we've released the minor patch for Subrion core (not package). So you still can apply your fixes and change package version to X.X.X.xx.

  20. Greg

    Greg Super Moderator

    I mixed up core with packages. Thanks @Andrew_G.

Share This Page