WordPress.org

Support

Support » Plugins and Hacks » FYI – If you would like to use this plugin with a CUSTOM hook you made

FYI – If you would like to use this plugin with a CUSTOM hook you made

  • lindsaybsc
    Participant

    @lindsaybsc

    I had created a custom hook just for WordPress stuff to be pulled in and because of that I needed to tweak the plugin a tad. I figured I would post what I needed to do to get it to work.

    Once your hook is already installed and working in Prestashop, these are the steps you need to take

    Open prestashop-integration.php

    On line 447 fine this:

    if ( !$this->hooks_names )
    				$this->hooks_names = ( version_compare(_PS_VERSION_, '1.5', '>=') ? array(
    					'HOOK_TOP' => 'displayTop',
    					'HOOK_LEFT_COLUMN' => 'displayLeftColumn',
    					'HOOK_RIGHT_COLUMN' => 'displayRightColumn',
                            // this is my custom hook
    					'HOOK_WP_COLUMN' => 'wordpressutil',
    					'HOOK_FOOTER' => 'displayFooter'
    				) : array(
    					'HOOK_TOP' => 'top',
    					'HOOK_LEFT_COLUMN' => 'leftColumn',
    					'HOOK_RIGHT_COLUMN' => 'rightColumn',
                            // this is my custom hook
    					'HOOK_WP_COLUMN' => 'wordpressutil',
    					'HOOK_FOOTER' => 'footer'
    				) );
    			if ( $hook )
    				return $this->hooks_names[$hook];
    			else
    				return $this->hooks_names;
    		}

    Add your custom hook to those two places. You can see what I did with my custom hook which was called “wordpressutil”

    Then you need to open prestashop-integration-controller.php and find this around line 50

    if (!isset($this->context->cart))
    						$this->context->cart = new Cart();
    					$smarty->assign(array(
    						'prestashop_integration' => $prestashop_integration,
    						'HOOK_HEADER' => Hook::exec('displayHeader'),
    						'HOOK_TOP' => Hook::exec('displayTop'),
             //my custom hook
    						'HOOK_WP_COLUMN' => Hook::exec('wordpressutil'),
    						'HOOK_LEFT_COLUMN' => ($this->display_column_left ? Hook::exec('displayLeftColumn') : ''),
    						'HOOK_RIGHT_COLUMN' => ($this->display_column_right ? Hook::exec('displayRightColumn', array('cart' => $this->context->cart)) : ''),
    						'HOOK_FOOTER' => Hook::exec('displayFooter'),
    					));

    You can see where I added my custom hook.

    Save those two files, go to your widget and you will now see your custom hook in the list and you will be able to pull modules that were hooked there.

    http://wordpress.org/extend/plugins/prestashop-integration/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author aytechnet
    Member

    @aytechnet

    Hi, sorry for my quite late response …

    Thanks very much, I will try to find something in order to add custom PrestaShop hook for WordPress.

    It will be quite fine as it is already easier to use WordPress to render only PrestaShop module as there are quite a lot of sidebar and existing plugin to enable/disable widget (and one widget could be PrestaShop Integration module that allow you to put a specific PrestaShop module where you want).

    A new version will be out, I will try to integrate your needs, there is already a new widget to come (to insert a custom smarty template, as asked by another user).

    Kind Regards,
    Fran├žois.

    lindsaybsc
    Participant

    @lindsaybsc

    Thanks Aytechnet. It’s not a major conflict because I was able to update it myself without a problem

    I do, however, have another issue that has cropped up. I have the shopping cart in my header and it seems that the cookie is not passing when I go to the wordpress side of my site, so my cart shows empty while I am browsing there, but not while I am in the store.

    Plugin Author aytechnet
    Member

    @aytechnet

    Hi LindsayBSC,

    Check the cookie part in the FAQ, you may need to update PrestaShop so that the cookie are available to WordPress (it is necessary if the blog is installed in root and PrestaShop in a subdirectory or another domain).

    Kind Regards,
    Fran├žois.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘FYI – If you would like to use this plugin with a CUSTOM hook you made’ is closed to new replies.