auto code

Discussion in 'Auto Classifieds Script' started by piagent, Nov 18, 2012.

  1. piagent

    piagent New Member

    Not sure this belongs here, this is not a core cms package question but auto package specific. Let me knoe if there is a place for these questions.

    in admin boats.php code the last line is
    $iaView->display('manage');

    I assume this is a reference to manage.tpl but I find two one in templates/admin and templates/common can you clear up my confusion?
  2. piagent

    piagent New Member

    HELP! Can you explain how this works, auto add listing has manage.js, when you select a make, then a model it calls back to get the children for the next select list. this call is
    http://boats4sale.makingsystemswork.com/BFS-2-2-3-package-autos/models.json&fn=?

    my guess it goes to system in the cms root, from there I get lost and what and where scripts are used. I know it has to make it back to admin and a script to read the table, just not sure which one and how it knows the path as I can't find anything in the package.
  3. piagent

    piagent New Member

    I looked over .htaccess and now I'm not sure if it gets to system.php how.
  4. Vasily_B.

    Vasily_B. Project Manager

    Greetings,

    If you are in admin panel then the script will look the requested file in admin/ folder. When you request something like:
    PHP:

    $iaView->display('manage');
     
    in your admin files the script will start checking your packages/boats/templates/admin/ folder. common/ directory is used for frontend files only.

    Regarding your second question. The guys will reply shortly! Thanks for your patience.
  5. piagent

    piagent New Member

    thank you. Yes, I'll wait because this json mapping will help me expand my code.
  6. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    This ajax request calls the code within this block in your package's index.php:
    PHP:

    if ($iaView->getRequestType() == iaView::REQUEST_JSON)
    {
    ......
    }
     
    You should see $iaView->jsonp() function inside. It gets the list of children to be displayed, forms it to json object, and returns this object to js/common/manage.js file.
    Last edited by a moderator: Nov 18, 2012
  7. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    So there how it works in common:
    Inside js/common/manage.js there is an event listener for changing value of the categories select box. It looks like this:
    Code (Text):

    first.css('display', 'inline-block').change(function(){
        intelli.autos.model_changed(this, that);
    });
     
    When you change the value of the select box it sends a json request using the url defined at the third line of manage.js file:
    Code (Text):

    url: intelli.config.packages.autos.url + 'models.json',
     
    intelli.config.packages.autos.url = a direct url to the index page of the package. So your_package/index.php file handles the json request, form categories and sends it back in json format.
    Further, the js script clones existed select box and prints it with the list of categories formed in index.php.
  8. piagent

    piagent New Member

    I see that code in the package directory autos.
    1)How is this code directed here to index with in the package?
    2)If I'm looking to add my own getjson how will I be able to direct it to my script, yes I see that I could modify the script to check for type.json, I'm trying to understand the routing method and how I can use it?
  9. piagent

    piagent New Member

    not sure I understand how it's a direct url. In the browser debug the value is
    http:// mysite.com/BFS-2-2-3-package-autos/models.json there is no index in the url. I understand how system.php can remap everything to one and only one packages/autos. So how does it know it is going to package/autos/index.php? what if I want it to go to package/autos/json_support.php with model.json, type.json, etc
  10. piagent

    piagent New Member

    Please if you can, explain the rewrite rules and where the code is, thank you.
  11. piagent

    piagent New Member

    Is there a way to pickup the path from the install for classes? require_once IA_PACKAGES . 'autos/includes/classes/ia.base.package.php' hard codes the autos path. If we change it to autosclassified then we need to edit these scripts. Ideas?
  12. piagent

    piagent New Member

    related to post 20, if you want to place the Autos package in an different directory name like autoclassified, where are all the script changes that have to be made? Just changing the classes hard coded path was not enough.
  13. piagent

    piagent New Member

    after selecting Car Lisitngs (code unchanged) I get the Cars for Sale by Make this is my parent level of autos_categs with counts.
    When I select the child I go to Autos Categories with counts.
    At the next child selection I get the following. No auto code has been changed, auto-categs has replacements for make and model titles. A smaller number of entries but the same depth.


    User Warning: Unknown column 't1.views' in 'order clause' SELECT SQL_CALC_FOUND_ROWS t1.*, t2.`title` `model` FROM `bfs223_boats_autos` t1 LEFT JOIN `bfs223_boats_autos_categs` t2 ON (t1.`category_id` = t2.`id`) WHERE 1 = 1 AND t1.`category_id` = '11' AND t1.`status` IN ('active','sold') ORDER BY t1.`views` ASC LIMIT 0, 10
    on line 168 in file includes/classes/ia.core.mysql.php
    Backtrace [8]
    Array
    (
    [0] => in class iaCore::init()
    on line [50] in file [includes/classes/ia.base.core.php]
    [1] => in class iaView::initializeOutput()
    on line [135] in file [includes/classes/ia.core.php]
    [2] => in function require("/home/boats4s/public_html/BFS-2-2-3-package-boats/packages/autos/index.php")
    on line [1281] in file [includes/classes/ia.core.view.php]
    [3] => in class iaAuto::get(Array(), 0, "10", Array())
    on line [93] in file [packages/autos/index.php]
    [4] => in class iaDb::getAll("SELECT SQL_CALC_FOUND_ROWS t1.*, t2.`title` `model` FROM `bfs223_boats_autos` t1 LEFT JOIN `bfs223_boats_autos_categs` t2 ON (t1.`category_id` = t2.`id`) WHERE 1 = 1 AND t1.`category_id` = '11' AND t1.`status` IN ('active','sold') ORDER BY t1.`views` ASC LIMIT 0, 10")
    on line [207] in file [packages/autos/includes/classes/ia.front.auto.php]
    [5] => in class iaDb::query("SELECT SQL_CALC_FOUND_ROWS t1.*, t2.`title` `model` FROM `bfs223_boats_autos` t1 LEFT JOIN `bfs223_boats_autos_categs` t2 ON (t1.`category_id` = t2.`id`) WHERE 1 = 1 AND t1.`category_id` = '11' AND t1.`status` IN ('active','sold') ORDER BY t1.`views` ASC LIMIT 0, 10")
    on line [212] in file [includes/classes/ia.core.mysql.php]
    [6] => in function trigger_error("Unknown column 't1.views' in 'order clause'SELECT SQL_CALC_FOUND_ROWS t1.*, t2.`title` `model` FROM `bfs223_boats_autos` t1 LEFT JOIN `bfs223_boats_autos_categs` t2 ON (t1.`category_id` = t2.`id`) WHERE 1 = 1 AND t1.`category_id` = '11' AND t1.`status` IN ('active','sold') ORDER BY t1.`views` ASC LIMIT 0, 10", 512)
    on line [168] in file [includes/classes/ia.core.mysql.php]
    [7] => in class iaSystem::error(512, "Unknown column 't1.views' in 'order clause'SELECT SQL_CALC_FOUND_ROWS t1.*, t2.`title` `model` FROM `bfs223_boats_autos` t1 LEFT JOIN `bfs223_boats_autos_categs` t2 ON (t1.`category_id` = t2.`id`) WHERE 1 = 1 AND t1.`category_id` = '11' AND t1.`status` IN ('active','sold') ORDER BY t1.`views` ASC LIMIT 0, 10", "/home/boats4s/public_html/BFS-2-2-3-package-boats/includes/classes/ia.core.mysql.php", 168, Array())
    )
  14. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    It's easy. The url points to autos package's root + 'models.json', meaning it sends json request to the package's root. As far as there's no additional options in the url it will automatically use index.php file.

    For example, If my install.xml adds 2 pages with parameters:
    1. url="|PACKAGE|"
    2. url="|PACKAGE|view_page/" filename="view"

    The url http://www.example.com/package/ will trigger index.php
    and url http://www.example.com/package/view_page/ will trigger view.php

    If I will remove filename="view" from the second page, the url will trigger index.php again, but the variable $iaCore->requestPath will have a node with "view_page" value.


    You should also change the name of the package to 'autoclassified' in install.xml


    Please open includes/classes/ia.front.auto.php, find this code:

    PHP:
    $validSortingFields = array('title', 'date', 'views', 'price', 'release_year' => 'year');
    and replace 'views' with 'views_num'.
  15. piagent

    piagent New Member

    and replace 'views' with 'views_num'. Did not solve the warning. I'll try to get back with more information.
  16. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    Please could you send us your FTP details in the ticket you have created? We will check and fix the problem.
    Thank you in advance!
  17. piagent

    piagent New Member

    please point me in the right direction. In admin listing I want to make changes, i want to eliminate the following fields release year, exterior color from the list and the table (this part has been done). I also want to put other fields in there place and expand the search fields. I see from the install that auto is called, i assume admin/auto and it wants to call admin/manage to display. I do not see how the columns are controlled. This is not like the frontend where I can specify a field is not used on that page. And where is the sort form setup?
  18. Gleb_S.

    Gleb_S. Subrion Designer Staff Member

    Please check if you have `views_num` column in your boats table.
    If no, alter table adding
    `views_num` mediumint(8) unsigned NOT NULL

    Also try to search your code for 'views' word. Maybe, it is used anywhere else but I found it only in includes/classes/ia.front.auto.php
  19. piagent

    piagent New Member

    Yes, I do
    `views_num` mediumint(8) unsigned NOT NULL

    It's all fixed now with includes/classes/ia.front.auto.php 'views_num'

    Now it's mileage it has a problem with, I took it out of the auto record, it's not in the sort or fields displayed. I'll try to track it down

    It's the admin listings I need to clean up, some columns must go and others in.
  20. piagent

    piagent New Member

    new question in auto package. In the admin home is the statistics, the home.tpl provides the info for the autos. In the tpl I see
    <div id="box_panels_content" style="margin-top: 15px;"></div>

    <div id="box_statistics" style="display: none;">
    <table width="99%" cellspacing="0" cellpadding="0">

    in the admin home page displayed I can find the <div id=box_statistics but can not find <div id="box_panels_content", what happen to it?

    Why is there a <hook name="populateCommonStatisticsBlock" in the install.xml, no one is using it, seems like it does statistics. What can it be used for?

    Can you tell me how StatisticsBlock - Subrion CMS works, do I place this hook in the installed named "phpStatisticsBlockAssembling" Why is there a </php> after </block> when this is to be a <hook>. Can you give a better example, more complete code, and why this is better than the home php/tpl method

Share This Page