我试图调整WP Woocommerce预订插件并添加从Google日历API获取事件的功能。类的调用函数,它不能调用类中的其他功能
有
类类WC_Bookings_Google_Calendar_Integration延伸WC_Integration
,它提供令牌获取和授权。
我增加了新的功能,以类
公共职能get_googlecal_bookings($ bookable_product,$ MIN_DATE = 0,$ MAX_DATE = 0)
是想取回所有预订在分钟之间以及某些产品的最大日期。
从我的functions.php我与
$ existing_bookings = WC_Bookings_Google_Calendar_Integration :: get_googlecal_bookings调用它($ bookable_product, 从$,$到);
这可以使用虚拟数据。
虽然,当我尝试使用function get_googlecal_bookings
内的其他类功能,如$api_url = $this->calendars_uri . $this->calendar_id . '/events/';
或$access_token = $this->get_access_token();
我什么也没有得到。
我知道,我打电话给他们错误的,只是需要点我在正确的方向
谢谢!将其更改为'$ foo = new WC_Bookings_Google_Calendar_Integration; $ existing_bookings = $ foo-> get_googlecal_bookings($ bookable_product,$ from,$ to);' – altermind
如果有帮助,会很开心。它现在工作吗? – musashii
是的,它的确如此。我需要更多地进入OOP。我提出了你的答案,但没有足够的声望来表明这一点。对不起:( – altermind