vampirehunter Posted August 8, 2012 Share Posted August 8, 2012 i was wondering if anyone can point me to the right way of doing this i have set up my website, everything, all pages etc are fine. but Just for the hompeage, ie when someone goes to mydomain.com i want my hompage to just have the header, and then in the main content, a big div banner and 3 small square banners below, followed by the footer. I've tried editing the index.php but i don't think its possible to add a loop in there, as both the category and manufacturer pages both are embedded in the index.php page. so if you click on a category, the url is: index.php?cPath=23 if you click on the manufacturer name the url is: index.php?manufacturer_id=1 So how do i change my index.php so that only when you are on the homepage ie just mydomain.com (index.php), it will show my specific custom html and not affect category or manufacturers. Currently, if i change the html, it affects the way category, and manufacturers look. Someone said htaccess redirect is best? if someone can specify whats the best way, that would be great. Cheers Link to comment Share on other sites More sharing options...
♥joli1811 Posted August 8, 2012 Share Posted August 8, 2012 Hi, do not know if this will help but if you put an index. html page in the shop it will overide the index.php and show first!!! john To improve is to change; to be perfect is to change often. Link to comment Share on other sites More sharing options...
vampirehunter Posted August 8, 2012 Author Share Posted August 8, 2012 ok thanks. yeah, but thing is, for my homepage, the header, and footer will be exactly same. the only thing i need different is the bodycontent. so i wont have any left or right columns or breadcrumbs. just some boxes like on this site. http://www.voluptua-uk.com/catalog/ the only problem is that index.php code references both the manufacturers and categories as part of its code. so if i remove columns from the index.php then they also wont show when i click on the categories or manufacturers box links, but i need them to show on them. i just need the hompeage to have some boxes in the middle. can't figure out a way to make a loop in the code that doesnt affect the category/manufacturer query. I'm surprised nobody has covered this particular topic before. A lof of ecommerce sites have a front page like the link above, with big banners and images. i've searched all over this site and google and nobody seems to know how this is done. I found one thread which says to do a redirect to a custom page which will show when you go to mydomain.com but im sure there is a way of making a loop to do this? Link to comment Share on other sites More sharing options...
vampirehunter Posted August 8, 2012 Author Share Posted August 8, 2012 Hi, do not know if this will help but if you put an index. html page in the shop it will overide the index.php and show first!!! john after a pain in the arse struggle. i think i found one solution. right at the top of index.php i put in this if (tep_not_null ($cPath)) { and the closing tag at the bottom. i then moved the require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); up just after the last <div> tag. from what i can see. this loop will give me a completly blank page if the cpath is empty and i go to index.php. so now i will have to add in link to my own custom template_top file and a template bottom file, and manually add in the new bodycontent. this seems the only way i can think of at the moment. if someone has another better solution, please let me know. thanks Link to comment Share on other sites More sharing options...
vampirehunter Posted August 8, 2012 Author Share Posted August 8, 2012 i found some info on this website here. http://www.oscommerce-template-easy.com/oscommerce-categories-display-file-structure/code-structure-main-content-vs-category-depth-and-cpath-1.html i now changed the loop to this at the top of index.php if (isset($cPath) && (tep_not_null ($cPath))) { and then at the end of the file added an else statement which contains links to my alternate template_top and bottom. so now hopefully, when someone goes to homepage, they will see my custom homepage only which has the same header/footer, but bodycontent has my own custom manually set div tags and banners etc. Since only a few can be bothered to offer advice on this forum, its quite shameful really. Its no wonder other shopping carts progress further and gain more popularity. if people were more open on here, it would be much better. I will test my code, if anyone has any issues with it in terms of coding structure, let me know, if its the correct way of coding or not. If its ok, ill put it into a fully detailed contribution because as far as i know, there is not a SINGLE forum post or thread on here which covers this topic on how to make a custom home page that doesnt affect categories. Link to comment Share on other sites More sharing options...
multimixer Posted August 8, 2012 Share Posted August 8, 2012 In one of your other posts about the same (or a similar) issue, you said that you installed "dynamic template system" that work fine and should do what you need regarding the columns The content part of the "home" page, start in file index.php after the } else { // default page That is close to the bottom of the page Since only a few can be bothered to offer advice on this forum, its quite shameful really. Its no wonder other shopping carts progress further and gain more popularity. I don't think this is correct The point is, that you try to do something without having the knowledge to do it, and for this you blame the software, the forum and I don't know who else There are many people here, offering free advice all the time. What you need, is somebody to tell you how to achieve some special customization you have in your mind. That's something different Break your questions into smaller parts, don't post the same issue all over, and be a bit more patient Also a better attitude would help, nobody is obligated to answer your questions My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
vampirehunter Posted August 8, 2012 Author Share Posted August 8, 2012 In one of your other posts about the same (or a similar) issue, you said that you installed "dynamic template system" that work fine and should do what you need regarding the columns The content part of the "home" page, start in file index.php after the } else { // default page That is close to the bottom of the page Since only a few can be bothered to offer advice on this forum, its quite shameful really. Its no wonder other shopping carts progress further and gain more popularity. I don't think this is correct The point is, that you try to do something without having the knowledge to do it, and for this you blame the software, the forum and I don't know who else There are many people here, offering free advice all the time. What you need, is somebody to tell you how to achieve some special customization you have in your mind. That's something different Break your questions into smaller parts, don't post the same issue all over, and be a bit more patient Also a better attitude would help, nobody is obligated to answer your questions Hi yes, the dynamic template system is working fine for removing columns. ive used that to remove the left and right columns from all the pages except the product_info page. But the issue im having is that if you remove the columns for the index.php ie home page. Then the columns will dissapear for when you view the categories and manufacturers, which i don't want to happen. I need just the main first homepage to have no columns, just header and footer, but this is not possible with dynamic template system as the categories is part of the index.php code. thats why i have used the method above to have a completely blank home page which i can populate with a custom content, first by calling my own custom template_top and template_bottom files. I read another post in a different thread which says simply to move the functions for categories/manufacturers into a different page. which makes sense, so i might try that as well. Also, im not blaming anyone. But its quite obvious that having the categories/manufacturers code embedded right into the index homepage makes having a different homepage ridiculously difficult. thats why ive had to resort to scouring forums, google and nobody has an answer. If it were such an easy task, im sure i would read a basic solution to it. But it seems nobody has, so its a good thing ive asked the question. I'm sure the next person who needs help on having a seperate home page to the rest of their site will thank me for trying to find out the answer Link to comment Share on other sites More sharing options...
♥14steve14 Posted August 9, 2012 Share Posted August 9, 2012 What most people do is to create a landing page using html.This can include header images, front page content and a series of images or text or whatever to be used as links to other areas of a website. It can be made to look exactly the same as the oscommerce storefront, and is easy to do, which is why most people do it. If you want to try and invent the wheel do so, but you will find that it is hard, and something that is good has already been done. Dont fix something that isnt broken. REMEMBER BACKUP, BACKUP AND BACKUP Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 hi Steve and anyone else who wants to know! Ive managed to find THE best solution for this, 100% working and tested. All thanks to foxp2. Its basically a matter of taking out the queries from index.php and putting them into a new page, ie shop.php. so any queries for categories/manufacturers will now run via shop.php. So no longer will it be index.php?cpath and index.php?manufacturer_id. Instead, these will be from shop.php?cpath and shop.php?manufacturer_id. I've put it into a contribution here (thanks to foxp2 for the tutorial): http://addons.oscommerce.com/info/8517 Best way to do it is in conjunction with foxp2's dynamic template system for 2.3, as that is basically allowing you to turn on and off boxes from columns AND decide which pages have these boxes. So that means you can decide which page has a column or box, all through admin. If you select no boxes for a page, then you will have no columns automatically, its all done via the code, no need to handcode anything. if you have no boxes, then automatically, your bodycontent class selects the correct one from the 960 css. So now my home page is titled index.php, ive selected no boxes on it, so bodycontent stretches full width, and has no queries for categories,manufacturers, whilst shop.php now runs those queries instead. Absolutely perfect. You basically have full control over layouts on every single page. Its so ridiculously easy and good, i think foxp2 plugin is incredible. Highly recommend this system. I really think this method should be default in any next version, because it makes so much sense logically, allowing your homepage to be seperate in terms of content and not restricted by those category/manufacturer queries. Link to comment Share on other sites More sharing options...
multimixer Posted August 9, 2012 Share Posted August 9, 2012 @@vampirehunter 100% working and tested What is if somebody just type in domain.com/shop.php ? Without cPath or manufacturer_id? My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 i think it may need a redirect loop so it goes back to the new index.php. what do you think? is redirect better or something else? if shop.php is clicked without any cpath or manufacturer, its the same as before when it was index.php. it shows the left column (because ive set it in admin) and still has breadcrumbs on this page. but at least you can have a seperate home page now. unless i was to use the loop if cpath is not null and put at the top of shop.php, so that if someone goes directly to shop.php it shows them an alterered page. what do you think is the best solution? Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 @@vampirehunter What is if somebody just type in domain.com/shop.php ? Without cPath or manufacturer_id? ive figured out one solution. basically, in the new shop.php file. this should be the top of the file, youre just adding one loop after the application top so it will look like this require('includes/application_top.php'); if (isset($cPath) && (tep_not_null ($cPath))) { then you can remove the last else statement, and move up the require template bottom and require application bottom into that loop. then after that loop you can add in an else statement which will show your custom html. To make it easier, i could simply put the content of the new index.php in its own seperate php file,and then just refernece that as a "requires" in both the new index.php and the shop.php. So if someone then goes to index.php, they see my custom homepage. If they type in just shop.php, they will see the exact same content as on index.php, because im referencing the exact same content. A bit quirky, but it does the job. Its what i originally did before i decided to make the category/manufacturer query code on index.php seperate in its own page. I could have just kept the original index.php file in its original form, but i figure its nice to keep it seperate. what do you reckon? was it just better to have everthing in the index.php file? </div> <?php require(DIR_WS_INCLUDES . 'template_bottom.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); } } else { require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); require(DIR_WS_INCLUDES . 'template_top_index.php'); require(DIR_WS_INCLUDES . 'homepagecontent.php'); require(DIR_WS_INCLUDES . 'template_bottom_index.php'); require(DIR_WS_INCLUDES . 'application_bottom.php'); } ?> Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 i may have to change the query at the top Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 i think the if statement has to be if ( basename($PHP_SELF) != FILENAME_DEFAULT . $cPath . '' and if manufacturer_id is not equal to 0. not sure how to write that in an if statement Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 @@vampirehunter What is if somebody just type in domain.com/shop.php ? Without cPath or manufacturer_id? you just put this loop at the top instead of the cpath one i put up before (this one wasnt correct) if (isset($cPath) && (tep_not_null ($cPath))) { this one is better if ( basename($PHP_SELF) != FILENAME_DEFAULT . $cPath . '' || basename($PHP_SELF) != FILENAME_DEFAULT . isset($_GET['manufacturers_id']) ) { you just make sure you move up templatebottom and application bottom so that they are in this loop. then in the else statement, you can refer to your different files like i said before. Link to comment Share on other sites More sharing options...
multimixer Posted August 9, 2012 Share Posted August 9, 2012 I think you go in circles. After doing that all, you arrived again at the point where you need exactly the same statement to distinguish the front page as before All you need is a statement in includes/template_top.php and includes/template_bottom.php to find out what level of index.php you are and act accordingly. I gave you that statement yesterday in an other post of you. if(basename($PHP_SELF) == FILENAME_DEFAULT && $cPath == '' && !isset($_GET['manufacturers_id'])) { This mean in plain english: if file is index.php and no cPath and no manufacturers id ..... However, in concrete in file includes/template_top.php find <div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>"> Replace with <?php if(basename($PHP_SELF) == FILENAME_DEFAULT && $cPath == '' && !isset($_GET['manufacturers_id'])) { // the front page ?> <div id="bodyContent" class="grid_24 "> <?php } else { // all other pages ?> <div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>"> <?php } ?> In file includes/template_bottom.php Find <?php if ($oscTemplate->hasBlocks('boxes_column_left')) { ?> <div id="columnLeft" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?> pull_<?php echo $oscTemplate->getGridContentWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?> </div> <?php } if ($oscTemplate->hasBlocks('boxes_column_right')) { ?> <div id="columnRight" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_right'); ?> </div> <?php } ?> Replace with <?php if( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath == '' && !isset($_GET['manufacturers_id']) ) { // the front page, do whatever you want } else { if ($oscTemplate->hasBlocks('boxes_column_left')) { ?> <div id="columnLeft" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?> pull_<?php echo $oscTemplate->getGridContentWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?> </div> <?php } if ($oscTemplate->hasBlocks('boxes_column_right')) { ?> <div id="columnRight" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_right'); ?> </div> <?php } } ?> As for the content of the front page, open file index.php and find near the end <?php } else { // default page ?> <h1><?php echo HEADING_TITLE; ?></h1> <div class="contentContainer"> <div class="contentText"> <?php echo tep_customer_greeting(); ?> </div> <?php if (tep_not_null(TEXT_MAIN)) { ?> <div class="contentText"> <?php echo TEXT_MAIN; ?> </div> <?php } include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?> </div> <?php } This is the front page content, you can change, delete, whatever, anything you want within the { } That's it, no reason to create new files etc In case you want to keep the solution you did, add your redirect just after the } else {, and replcae the above code like this <?php } else { // default page // redirect to anywhere you want, eg, your new page } ?> I would however do this all on the template class level leaving all that poor files in peace. The system is able to find out what page/level is in use at any moment My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
vampirehunter Posted August 9, 2012 Author Share Posted August 9, 2012 I think you go in circles. After doing that all, you arrived again at the point where you need exactly the same statement to distinguish the front page as before All you need is a statement in includes/template_top.php and includes/template_bottom.php to find out what level of index.php you are and act accordingly. I gave you that statement yesterday in an other post of you. However, in concrete in file includes/template_top.php find <div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>"> Replace with <?php if(basename($PHP_SELF) == FILENAME_DEFAULT && $cPath == '' && !isset($_GET['manufacturers_id'])) { // the front page ?> <div id="bodyContent" class="grid_24 "> <?php } else { // all other pages ?> <div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>"> <?php } ?> In file includes/template_bottom.php Find <?php if ($oscTemplate->hasBlocks('boxes_column_left')) { ?> <div id="columnLeft" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?> pull_<?php echo $oscTemplate->getGridContentWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?> </div> <?php } if ($oscTemplate->hasBlocks('boxes_column_right')) { ?> <div id="columnRight" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_right'); ?> </div> <?php } ?> Replace with <?php if( basename($PHP_SELF) == FILENAME_DEFAULT && $cPath == '' && !isset($_GET['manufacturers_id']) ) { // the front page, do whatever you want } else { if ($oscTemplate->hasBlocks('boxes_column_left')) { ?> <div id="columnLeft" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?> pull_<?php echo $oscTemplate->getGridContentWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_left'); ?> </div> <?php } if ($oscTemplate->hasBlocks('boxes_column_right')) { ?> <div id="columnRight" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?>"> <?php echo $oscTemplate->getBlocks('boxes_column_right'); ?> </div> <?php } } ?> As for the content of the front page, open file index.php and find near the end <?php } else { // default page ?> <h1><?php echo HEADING_TITLE; ?></h1> <div class="contentContainer"> <div class="contentText"> <?php echo tep_customer_greeting(); ?> </div> <?php if (tep_not_null(TEXT_MAIN)) { ?> <div class="contentText"> <?php echo TEXT_MAIN; ?> </div> <?php } include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?> </div> <?php } This is the front page content, you can change, delete, whatever, anything you want within the { } That's it, no reason to create new files etc In case you want to keep the solution you did, add your redirect just after the } else {, and replcae the above code like this <?php } else { // default page // redirect to anywhere you want, eg, your new page } ?> I would however do this all on the template class level leaving all that poor files in peace. The system is able to find out what page/level is in use at any moment hi thanks do you think its better on performance to keep everything in index.php and do like you suggest? or will it not make much difference to the other method? i know the shop.php is a different method, what do you think is best? Link to comment Share on other sites More sharing options...
multimixer Posted August 10, 2012 Share Posted August 10, 2012 All roads lead to rome, but ... the less code you use and the closer you remain to the original structure, the better it is My community profile | Template system for osCommerce - New: Responsive | Feedback channel Link to comment Share on other sites More sharing options...
vampirehunter Posted August 10, 2012 Author Share Posted August 10, 2012 All roads lead to rome, but ... the less code you use and the closer you remain to the original structure, the better it is Cool thanks, you guys have been really helpful. I think im slowly re learning what i forgot a few years back. Its take a while to get back upto speed with this php code. I have a kind of love/hate relationship with it. when it works its great, when it doesn't, it frustrates me and then i go around in circles. Also, sorry if i came across as a bit eager before, i think i posted too many threads. Sometimes, when ive tried different methods, i sometimes am able to get the solution. PS, that iphone website you made looks very slick! did you install extra product attributes fields for that? the product info page is really detailed and populated. Top quality stuff. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.