Jump to content

Save Hook Problem


Jon
 Share

Recommended Posts

Hello,

I seem to have having a problem the save hook.

I would like to field value based another field during the save process. But my values are not updating 13 seems to be enter no matter what and $vessels doesn't save updates. The code I am using is the following.

<?php 

$this->pages->addHookAfter('saveReady', null, 'cruiseSpaces');

function cruiseSpaces($event) {
    $page = $event->arguments[0];
    if($page->template != 'cruise-dates') return;
    $vessel = $page->cruise_vessel;
    if($vessel = 2) {
        $page->set("cruise_spaces", 13);
    }else{
         $page->set("cruise_spaces", 10);
    }
    
        
}

Any ideas where Iam going wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...