Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Addon} Modular Front Page


kymation

Recommended Posts

There are many pages that would benefit from being modular, and the Categories page is certainly one of those. I have thought about doing this, but I just don't have the time right now. If you want to do it, go for it.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

There are many pages that would benefit from being modular, and the Categories page is certainly one of those. I have thought about doing this, but I just don't have the time right now. If you want to do it, go for it.

 

Regards

Jim

I think this one above my skill base!

 

I have been reverse engineering the files to see if I can get anywhere.

 

Have managed to strip index.php to the bare basics as so to show only your front_page addon and the internal_page addon that I have created from your great work.

 

Now... from what I have understood, the code that was in index.php, that controls the child categories. This has to be re-written and placed inside function execute()?

 

This is where I am way out of my depth!

 

I have spent around 7 hours to get to the position I am at now. The main problem I am finding is how to debug the code I am modifying.

 

If I can find a means of testing small parts of code then maybe I could get somewhere, however, seeing that even the slightest error in an operator, character etc throws an exception I am lost, as I may have been writing 'correct' code, but wouldnt know because of a simple mistake.....

Edited by mongoled
Link to comment
Share on other sites

Keep the discussion here or start a new thread -- it's up to you. I don't care. There's already a fair amount of development discussion in here, so you're not doing anything new.

 

If you want to test out an idea, you can put it into a small file by itself and run that. Include application_top.php at the top to get all the variables, database, etc. Add a print or print_r statement at the end to see what you get. Then build up the code one piece at a time. When you have it all working, then try it in the module or wherever it goes. Note that outside variables in a module need to be named in a Globals statement before they are used.

 

Yes, the meat of a module gets put into the execute() method. Any setup/initialization can go in the class method. The rest is module installation stuff. I should probably write a "How to Write a Module" Tip so others will start writing them. They're a great way to make it easy for new folks to change the store without editing code.

 

I don't take any credit for the modules system. The core team did all of the heavy lifting. I'm just adding a few pieces that they made possible.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Keep the discussion here or start a new thread -- it's up to you. I don't care. There's already a fair amount of development discussion in here, so you're not doing anything new.

 

If you want to test out an idea, you can put it into a small file by itself and run that. Include application_top.php at the top to get all the variables, database, etc. Add a print or print_r statement at the end to see what you get. Then build up the code one piece at a time. When you have it all working, then try it in the module or wherever it goes. Note that outside variables in a module need to be named in a Globals statement before they are used.

 

Yes, the meat of a module gets put into the execute() method. Any setup/initialization can go in the class method. The rest is module installation stuff. I should probably write a "How to Write a Module" Tip so others will start writing them. They're a great way to make it easy for new folks to change the store without editing code.

 

I don't take any credit for the modules system. The core team did all of the heavy lifting. I'm just adding a few pieces that they made possible.

 

Regards

Jim

Thanks for that info, ive made a little more headway, but am stuck again.

 

I moved some code from the index.php page that takes its $cPath references from application_top.php (line 16) into the module I am making for cotrolling the categories page.

 

Now, from what I have understood, for this code to work it needs this directive

 

require('includes/application_top.php');

 

Where I am stuck, how do I get my module to reference this include?

 

When I use this path ../../includes/application_top.php from the file in the modules/mymodule folder

 

I get a message telling me

 

Warning: require(../../includes/application_top.php) [function.require]: failed to open stream: No such file or directory

 

From what I have understood, the category child element works by making checks to the $cPath variable, which is taken from application_top.php

 

But I dont know how to get the module to reach this.

 

Any pointers would be appreciated.....

Edited by mongoled
Link to comment
Share on other sites

You don't need to worry about application_top.php -- it will have already been included by the time the module class is instantiated. What you do have to do is bring in any variables that are not already globals. In the case of $cPath that would be adding this to the top of the method:

 

Global $cPath;

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

You don't need to worry about application_top.php -- it will have already been included by the time the module class is instantiated. What you do have to do is bring in any variables that are not already globals. In the case of $cPath that would be adding this to the top of the method:

 

Global $cPath;

Regards

Jim

Thats great information, thanks :)

 

Will try that in the New Year, have a bachelors party tonight and New Year Eve after that, lol, will be a little while before my head will be OK!

 

Happy New Year to all for when it comes

Link to comment
Share on other sites

Hi there,

 

I installed the Modular Frontpage (v1.2.2) on a fresh 2.3.1 installation but I can´t get the Javascrips to run (banner and scroller). I don´t receive any error message at all. What could be the problem? Something on the server side?

 

/ Mikael

Link to comment
Share on other sites

Do you have Javascript enabled in your browser? Check that all of the files have been uploaded to your server. The Javascript files are in the ext/ folder.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

AAAAAAAAGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr.

 

Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhh..........................

 

I feel better now!

 

Found what was causing my issues, and now need to know if a solution exists.

 

This happened by accident, by the way.

 

http://www.domain.com/catalog/

 

IS NOT THE SAME AS

 

http://www.domain.com/catalog/index.php

 

!!!!!!!!!!

 

The banner rotator and scroller module DO NOT LOAD on the page

 

http://www.domain.com/catalog/

 

But if we load

 

http://www.domain.com/catalog/index.php

 

Everything is fine, so how do we fix this (will try to work this out myself!)

 

-- EDIT --

 

OK, I tried to put an OR statement after

 

$PHP_SELF == 'index.php'

 

like this

 

$PHP_SELF == 'index.php' || $PHP_SELF == '/'

 

But it didnt work, lol

 

I think I will just wait for Kymation to help with this!

Easy install Ultimate Seo Urls 5 PRO and check the button that says Force www.mysite.com/ when www.mysite.com/index.php

Link to comment
Share on other sites

Or just add the .htaccess code that does the same thing

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]

and avoid adding a bunch of code that you don't need.

 

Regards

Jim

Edited by kymation

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi guys,

 

I have installed this contribution on OC2.3.1.

Everything seems working fine but I have noticed that there are two errors in the following files:

 

Error: Undefined index: tax_id

File: includes/modules/front_page/featured.php

Line: 84

Error: Undefined variable: header

File: includes/modules/front_page/scroller.php

Line: 47

 

Has anyone seen this before?

Any ideas?

 

Regards

JK

 

 

Or just add the .htaccess code that does the same thing

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.example.com/ [R=301,L]

and avoid adding a bunch of code that you don't need.

 

Regards

Jim

Link to comment
Share on other sites

Those are both bugs. For the first one, change Line 84 in includes/modules/front_page/featured.php to this:

           $products_price .= '<span class="productSpecialPrice">' . $currencies->display_price( $featured_products['specials_new_products_price'], tep_get_tax_rate( $featured_products['products_tax_class_id'] ) ) . '</span>';

For the second, change Line 47 in includes/modules/front_page/scroller.php to this:

       $header = '<script type="text/javascript" src="ext/modules/front_page/scroller/jquery.smoothDivScroll-1.1-min.js"></script>' . "\n";

Thanks you for the bug report. I've added these to the master and will upload a new version.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

No worries mate,

 

Anytime.

 

By the way. I think I have found another problem.

 

If you browse in the product_info page everything work but an error is thrown:

 

E_NOTICE Error Count: 2

Error: Use of undefined constant HEADING_TITLE - assumed 'HEADING_TITLE'

File: includes/modules/front_page/heading_title.php

Line: 36

 

Any ideas?

 

Cheers

JK

 

I've uploaded the new files to the usual place.

 

Regards

Jim

Link to comment
Share on other sites

That's a bug. The modules are being set on all pages, but they should only execute on the front page. Some of them have the code to do this, but apparently I missed some. I'll fix this and upload a new distribution. Thanks for the bug report.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've uploaded a patched version. These are minor changes, so only update an existing installation if you are having problems.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

Thanks for the upload.

The changes fix the original problem but generate another one:

 

E_NOTICE Error Count: 1

Error: Undefined variable: cPath

File: includes/modules/front_page/heading_title.php

Line: 34

 

I guess something is still missing.

Any ideas?

 

Kind Regards

JK

 

I've uploaded a patched version. These are minor changes, so only update an existing installation if you are having problems.

 

Regards

Jim

Link to comment
Share on other sites

I have just installed the latest version of this. All went well, until, i added text for the front page. When i went to modify this text in admin i get the following error.

 

Parse error: syntax error, unexpected T_STRING in /home/railway1/public_html/test_2.3/admin/modules.php(232) : eval()'d code on line 28

 

I hope this is not serious for me.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Error: Undefined variable: cPath

File: includes/modules/front_page/heading_title.php

Line: 34

<snipped>

Yes, that's a bug introduced by my fix for the previous bug. I'll fix that. Thanks for the bug report.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Bugs fixed and a new version uploaded. thanks again to everyone who has been posting bugs. I need all the help I can get.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

I've uploaded a new release with the Specials header link. It's an option so you can turn it off if it's not something that you want. Remember to uninstall the module before uploading a new version.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Hi Jim,

 

I love this Modular Front Page! a must to have...

 

There is an extra semicolon ";" on line 74 in the catalog/includes/modules/front_page/upcoming_products.php. This should be removed?

 

Thanks,

Andy,

Edited by andyn
Link to comment
Share on other sites

Yes. There's one in the new products and the featured module as well. I suspect that Eclipse went crazy on me there, or I deleted part of a line and left only the semicolon. Fixed in the master, but I'm not going to upload until I get something more important. At least this doesn't cause any errors or stop the module from working.

 

Thanks for the error report.

 

Regards

Jim

See my profile for a list of my addons and ways to get support.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...