Skip to content

Instantly share code, notes, and snippets.

@andriyun
Created October 22, 2020 09:50
Show Gist options
  • Save andriyun/3938aa78af909dca4dff0a41f10fbc6f to your computer and use it in GitHub Desktop.
Save andriyun/3938aa78af909dca4dff0a41f10fbc6f to your computer and use it in GitHub Desktop.
<?php
/**
* Helper function to log info.
*/
public static function _bc_filelog($message) {
error_log(print_r($message, 1) . PHP_EOL, 3, '../checkout-session-info.log');
}
/**
* {@inheritdoc}
*/
public function addCartId($cart_id, $type = self::ACTIVE) {
$key = $this->getSessionKey($type);
$ids = $this->session->get($key, []);
$ids[] = $cart_id;
$this->session->set($key, array_unique($ids));
self::_bc_filelog(date('Y-m-d H:i:s', strtotime('now')) . ' ' . __FUNCTION__);
self::_bc_filelog($_SESSION);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment