X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Wordpress in XC5 -- wordpress home page as site home page? (https://forum.x-cart.com/showthread.php?t=70285)

JannieB 10-19-2014 09:12 AM

Wordpress in XC5 -- wordpress home page as site home page?
 
Hi,
I have installed the wordpress module to XC5 ... all fine.

There is an option to have recent posts on the home page of the site .... I don't want this, I want the page I have denoted as the wordpress home page to appear here ....
... any idea how I can do that?

I have tried making an htaccess rule to direct the index page to be /blog/index.php - but it doesn't like that! There must be a simple way ...

Any ideas?

Jan

soldatov 10-20-2014 10:46 PM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Hi Jan,

Just a quick question.

Not sure that I understand what exactly you need...

Do you need the wordpress-in-xcart page to be displayed first (as it does when you click on the "Blog" tab), or you need the Wodrpress itself to be showing first instead of X-Cart's homepage?

JannieB 10-21-2014 12:34 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Hi,

Yes I want the "wordpress in x-cart" page to display as the home page .... so the same as if you had clicked the "Blog" tab.

I tried and failed to do this with .htaccess ..... but then I'm no expert at rewrite rules ....

Thanks,

Jan

soldatov 10-21-2014 03:11 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
You can try the .htaccess rule:

Code:

DirectoryIndex cart.php?target=blog

Let me know if this helped.

JannieB 10-21-2014 04:18 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
I tried that and it came up with page not found ... even though the url ended with /blog/. If you then press refresh it comes up with the right page ......
...

I think it's dropping through to the rewrite rules below it. I'm wondering if a 301 redirect might do it but not sure how to stop it redirecting everything!

I think what I need to tell the htaccess is to redirect to /blog/ if there is no filename (or if the filename is just cart.php)


Jan

soldatov 10-21-2014 04:22 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Well, in this case I'd recommend you to ask Qualiteam for a quote for this modification. This can be done within the HelpDesk interface.

JannieB 10-21-2014 04:43 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Thanks for your help .... it's such a simple thing really ... I can't understand why its so hard ......

reluctant to spend money on something they can probably answer in 5 minutes .....

... I will persevere!

If anyone from Qualiteam reads this ... please help.

JannieB 10-22-2014 03:26 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Having given up on the rewrite rules, I am trying a different tack ...
... trying to include "main" as an Allowed target for the blog class, in the hop of adding the wordpress module to the home page ...
so far I have added this class in my custom module:

Code:

class WordPress extends XLite\Module\QSL\WordPress\View\WordPress implements \XLite\Base\IDecorator
{
    /**
    * Return list of allowed targets
    *
    * @return array
    */
    public static function getAllowedTargets()
    {
                return array_merge(parent::getAllowedTargets(), array('main'));
    }

 protected function isVisible()
    {
        return (\XLite::getController()->getTarget() == 'main' && \XLite\Core\Config::getInstance()->QSL->WordPress->section_style == 'content section') ? true : false;
    }
       
}


But no joy ..... surely there must be a away to do this?

Can anyone help?

Jan

tony_sologubov 10-23-2014 05:27 AM

Re: Wordpress in XC5 -- wordpress home page as site home page?
 
Hi Jan!

I believe, after change of getAllowedTargets() method you start receiving PHP errors into <X-Cart>/var/log/ folder like this:

Code:

[23-Oct-2014 15:09:46 Europe/Berlin] PHP Fatal error:  Call to undefined function XLite\Module\QSL\WordPress\View\getInfoAboutWP() in /Applications/MAMP/htdocs/next/src/var/run/classes/XLite/Module/QSL/WordPress/View/WordPress.php on line 58
[23-Oct-2014 15:09:46] Error (code: 1): Call to undefined function XLite\Module\QSL\WordPress\View\getInfoAboutWP()
Server API: apache2handler;
Request method: GET;
URI: /next/src/;
Backtrace:
#0  Includes\ErrorHandler::logInfo(Call to undefined function XLite\Module\QSL\WordPress\View\getInfoAboutWP(), 1) called at [/Applications/MAMP/htdocs/next/src/Includes/ErrorHandler.php:324]
#1  Includes\ErrorHandler::handleError(Array ([type] => 1,[message] => Call to undefined function XLite\Module\QSL\WordPress\View\getInfoAboutWP(),[file] => /Applications/MAMP/htdocs/next/src/var/run/classes/XLite/Module/QSL/WordPress/View/WordPress.php,[line] => 58)) called at [/Applications/MAMP/htdocs/next/src/Includes/ErrorHandler.php:309]
#2  Includes\ErrorHandler::shutdown()


If you look into these errors you will see that you need to require_once several PHP files:
<X-Cart>/classes/XLite/Module/QSL/WordPress/wp/wp-lib.php
<X-Cart>/blog/wp-load.php

and then track down other errors if they arise.

All I can say is that WP module was done with assumption that it will be displayed on blog page. That is why implementing it on home page should be considered as another task. Pretty much the same as skot told you earlier.

Anyway, I am not saying that you cannot accomplish it yourself. Surely, if you have PHP knowledge, you will implement this task.


All times are GMT -8. The time now is 03:13 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.