2 Miles from the DE Memorial Bridge
Setup Instructions
After Copying
First thing I do is remove all the unnecessary files...
- /pages/examples/
This entire directory is not necessary. - /pages/oem/
This entire directory can be removed for sites that are not authorized dealers for some brand like Freightliner or Western Star, etc... otherwise you can keep this directory and any pages that apply to the dealer. - /pages/system/
This directory contains some system pages/files that may or may not be used, you can selectively delete pages not needed.- banner.php, files.php and downloads.php are for some features we recently added that only 1 company uses, and usually arent needed. They allow the customer to control the top banner that we use sometimes on sites, and control a downloads page where the customer can upload files for viewers to download.
- credit-app.php should stay if the customer uses our cognito forms credit application.
- dealers.php is only for special setups where a company actually displays units from many dealers, this is usually never used.
- privacy-policy.php, terms-conditions.php and search.php should always stay, they are usually always used.
- /pages/setup.php can be removed, it is this page you are on now.
- /pages/home.php needs to stay, it is the main homepage of the site.
- /pages/contact-us.php usually needs to stay, almost everyone has a contact us page.
- /pages/sitemap.php usually needs to stay, almost everyone has a sitemap though occasionally some sites with low inventory counts don't need it. Setting up sitemaps is another whole process but part of it uses this file.
- /pages/trucks-for-sale.php and /pages/trucks.php are a search page for inventory, and a spec page for individual units, setup to show just "trucks". I usually delete them all except the /trucks-for-sale.php and the /trucks.php (since these are setup the most common way we use them) and just then copy these pages for use with other things like trailers for example (renaming them to trailers-for-sale.php and trailers.php). All of the other copies of trucks-for-sale php pages (and the trailer pages) are setup for example display purposes on this dev.imanpro.net URL and show different ways of displaying things, or use different functionality aside from the norms. Further down it explains how to set these pages up to display differently.
The Config File
Next thing I do is setup the /config/config.php main config file. This file has a bunch of variables in it that need set.
- First thing at the top of the file are the database connection variables, they need set to the proper company.
- Next is all the company info (company name, address, phone, etc.). These variables are used in the header, footer, and contact us page mainly but maybe also get used elsewhere I'm not thinking of at the moment. Setting all this info here means you don't have to keep copying it to different parts of the site where it is needed. If anything doesn't apply (like an email address) just leave that variable blank. There are also places to set a handful of common social media site links that the company may have, again if any don't apply just leave them blank (they all are set to "#" to start with so that the social media links all appear in header and footer as an example, without needing real links there).
- Next are a couple variables to determine which credit application is used if any, either the imanpro cognito credit app, or the EFS credit app. Set the particular app needed to "1" and the one not needed to "0" (or set them both to zero if no credit app is needed). The EFS credit app requires an additional variable set which holds a bunch of company info (i.e. $config['efs_string'] = "group=1077&dealer=1170&agent=2967&redir=transchicago.com").
- Next is the menu PHP array, it is failry simple to manage. Each menu item looks like "Title" => "/page-url/", or in the event that a menu item has a dropdown menu, it is "Title" => "another menu php array here" (which is structured the same way). It will even do a dropdown within a dropdown, but is rare we ever do that.
- The next few variables under that control some aspects of how the menu works/displays, they are as follows...
- $page['mainmenu_force_active'] will set menu items as highlighted when you re on a specific page that does not match the URL in the menu item. For example, if someone is viewing an individual truck spec page, and you want the "Trucks" menu item to be highlighted, it won't automatically be highlighted because it points to the truck search page not the spec page, so you can use this array to force it to be highlighted by setting the menu item title and the url it should be highlighted on like.... "Menu Item Title Here" => "URL Here".
- $page['mainmenu_open_new_window'] is just a simple array containing the menu item titles which need to open in a new window.
- $page['mainmenu_force_submenu_width'] allows you to set the width of a given menu item's submenu, in case you have really long titles in it (i.e. "Trucks" => '300px' will make a submenu underneath the menu item "Trucks" 300px wide.
- $page['alternate_search_pages_dropdown'] doesn't deal with the main menu, but actually wlil insert an extra dropdown item at the top of the left sidebar search form on search pages, allowing viewers to easily move to a different search page (for example if on the trucks search page, they can use this dropdown to move to the trailers search page, or equipment search page, etc.). This is set to show trucks for sale and a trailers for sale by default so it appears on this example static site, but if a company only has one type of search page just comment out or remove any entries from this array so that this dropdown will not appear on the search form.
- The rest of the config file just has a list of assets used on pages (javascript and css files) which doesn't need editing usually, and then a bunch of sitemap variables for the sitemap script so it knows what to do. The sitemaps are confusing, so I will add more about how those work in the future to this file. For now I can set those up pretty quick.
Setting Up Inventory Search Pages for Trucks, Trailers, Equipment, Parts, etc.
/pages/trucks-for-sale.php is the inventory search page.
At the top of this file are a bunch of variables that control most everything you would need to setup/configure. Here is what they all mean and how they can be congifured...
- The Meta Variables at the top allow you to set a title, description, and canonical URL for each page in the site (all pages have these variables). In the situation of search and spec pages, they do not need set, instead the $page['auto_generate_meta'] needs to be set to "1" to tell the scripting to generate this info automatically based up upon the submitted search variables, or the particular truck or trailer being viewed. You only need to set meta data on regular non search/spec pages (and in that case $page['auto_generate_meta'] should be set to "0".
- Next is $use_assets_additional_css and $use_assets_additional_js which just tell the script which css and js files (from the config file) need to be included on this page. You can leave it as is for search and spec pages, it is including all that needs to be included.
- Next is a bunch of variables that will "force" certain search variables to be used on the page. For example, it will show $_REQUEST['category'] = array('Tractor', 'Truck', 'Dump', 'Lightduty') by default, which are the classes for trucks. This means this page will always show these classes of inventory from the database, and nothing else. For a trailers page, it would need to be for example, $_REQUEST['category'] = array('Trailer') (Trailers only have that one class, not like trucks, which have 4 different classes. Other classes used are 'Parts', 'Equipment', and occassionally other things that some companies may use. There are a bunch of other variables as well, which are all commented out, but can be usedd to force a page to show for example only new units, or a specific mmake like Freightliner, etc... Basically there is a way to force any possible search parameter that appears on the search forms.
- $config['extra_sql'] can generally be left as is, but is used for including any other important info into the database query that gets run on the given page. For example, if you don't want to display any trucks without photos, you would add to it "AND photo = 1" so that only trucks with photos get returned in the search.
- $config['orderby'] adds an "ORDER BY" to the query to give it a default order of the results. The end viewer can change this with a dropdown on the page, but generally we usually use something like "ORDER BY iMP_vShared.id DESC" (newest first) or "ORDER BY iMP_vShared.rprice DESC" (highest price first). I see it is set wrong by default, showing the oldest first, so just double check this.
- $config['perpage'] is how many results to display on each page. May need tweaked depending on which type of display we are using (for example a display of three boxes across a row, would need a number of results that is divisible by three, to avoid empty blocks at the bottom of the page).
- $config['use_dealer_tables'] is a special use things for only 1 or 2 companies, the ones that show results from multiple dealers. This should just be left set to "0", and ignore the other indented variables under it.
- $config['vscfields'] should always be left as 1, all sites use this feature now but at one time many sites didn't.
- $config['spec_page'] = "/trucks/" should point to the URL of the matching spec page so links on search results lead to the right page.
- $config['spec_page'] as an array (commented out next in the file) can be used instead on search pages that maybe show many different classes of equipment on the same page, and tell the scirpt to link things of particular classes to particular spec pages. We don't often have multiple classes of things on the same pages, like trucks and trailers, so usually this can be left commented and $config['spec_page'] can just be a url as mentioned above.
- $config['use_friendly_links'] = 1 is the new way we do things usually (this creates URLS like /trucks-for-sale/sleeper/freightliner/cascadia rather than our old way of doing URLS which would look like /trucks-for-sale/?type=sleeper&make-freightliner&model=cascadia). Directly under it are two arrays which need to have the 'dir' part of it show the proper URLS to the search and spec pages being used, however there is no need to adjust the other 'vars' stuff which appears there. To use the search engine friendly URLs that we have started using recently, it also involves some .htaccess entries to handle the dynamic fake URLs. These already exist in the .htaccess file for the /trucks-for-sale/ and /trucks/ URLs, but would need edited if using different URLs, or copied for additional search and spec pages.
- Everything below this controls how the search page is displayed...
- $config['descriptive_label'] = "Trucks" needs set to a generic plural term for what this page is displaying, such as "Trucks", "Trailers", "Equipment", "Truck Bodies", etc.
- $config['5050'] if set to "1" will display things in a 50/50 split on the page (go to main menu above and look under "Trucks", "Older 50/50 Layout" to see what that looks like. $config['show_alternating_5050_layout'] below that, if set to "1", will show the same layout but slightly different (one of the 50/50 colums has photo and description reversed so that photos are side by side and descriptois/stats on the outside).
- $config['gator_style'] if set to "1" will show the search results in a block fasion, 3 across the page in each row. Named for the first site we used it on, Gator Truck Sales.
- $config['show_pagination'] and $config['show_header_crumb'] should usually be set to 1, except in the case you are using this search page as the home page. We generally keep the pagination and headers and crumb links hidden on the homepage, and always show it on the official search pages.
- $config['search_form_style'] Can be set to "0" to hide the search form (which again we hide only if making a special page of results like on the homepage), or set to "1" to show the left sidebar search form, or "2" to show the top search form. You pretty much only use the top search form when displaying things in the "Gator Style" of blocks, and the left sidebar search form if not using the "Gator Style" blocks. In fact, trying to show the wrong search form display (like left sidebar search form on a gator display, or top search form on a non gator display, breaks the layout).
- All of the indented variables below the search form style, only apply to a "Top" search form. It allows you to pick and choose which search parameters appear. You can usually leave as is.
- $config['show_description'] if set to "1" shows a snippet of the truck's description along with the search result, and only works if not using the gator style of display which is a block that has no room for a description snippet.
- $config['show_dealer'] will show dealer info along with the search result, and again, does not work with gator style blocks as there is no room for dealer info there. The indented variables under is allow you to pick and choose which dealer info is displayed.
- $config['use_seo_1'] and $config['use_seo_2'] can be left to 0, this we havn't used in a long while but will add extra seo info to the search pages (like lists of makes and models found on the page, or states in which the units are located).
- $page['nopic400'] and $page['nopic800'] are pictures used when a given truck or trailer has no photo, leave these be.
- $page['use_external_images'] and $page['external_images_field'] are rarely used so can be left set to "0" or blank, and let the script know that we don't host the images, they are externally hosted and one of the database fields holds the list of image URLs.
- And finally $db = use_DB(); should always be on search and spec pages to let the script know to connect to the database. It should always be commented out on non search and spec pages as they have no reason to ever read from the database.
Setting Up Inventory Spec Pages for Trucks, Trailers, Equipment, Parts, etc.
/pages/trucks.php is the inventory spec page.
This file contains many of the same variables mentioned above for the search pages, but far fewer of them. So they would just be setup the same way. Here are the few differences in variables between the search pages and spec pages...
- Instead of setting a $config['spec_page'] variable with a URL to the spec page, you set a $config['search_page'] with a URL to the search page.
- The $config['extra_sql'] should be left blank, instead there is a variable $config['extra_sql_simunits'] that needs set instead.
- The rest of the variables in the spec page are described above in the search page stuff.
Using a Search Page as the Home Page
Sometimes we show search results on the homepage. To do this, simply copy a search page like /pages/trucks-for-sale.php to /pages/home.php, then configure it like so...
- Set the meta variables mentioned above to have a proper title, description and canconical URL, and set the variable $page['auto_generate_meta'] to "0" so the script doesn't try to rewrite the meta variables.
- Set the variables mentioned above to show no search form, no headers and crumbs, and no pagination (this results in just the search results themselves appearing).
- Around line 292 of the search page there is a <div class="container"> which starts the search results, you can add any HTML you want to appear on the page "above" the search results here, above this container.
- Around line 602 of the search page there is a </div> which ends the search results, you can add any HTML you want to appear on the page "below" the search results here, below this closing div.
- If you just want to add custom HTML to a search page that isn't the homepage, it works the same way, you just aren't hiding elements like search forms or headers and what not.