witrin / TypoGento

Integrating Magento with TYPO3.
15 stars 3 forks source link

Login via onePageCheckout // Logout generally #28

Closed Smucks closed 11 years ago

Smucks commented 11 years ago

It seems there is a problem when i try to login via the onePageCheckout. I get only logged in in Typo3, but not correctly in Magento.

I have the following pages:

Templates:

On the Shop Page ID 10


/**
 * Setup generic routes for dispatching and rendering
 */
config.tx_typogento {

   # Similar to Flagbit's TypoGento routing without Ajax support
  routes {

     # The dispatch route
    10 {

       # See http://wiki.typo3.org/TSref/if
      filter.isTrue = 1

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Overrules FlexForm parameters with GET parameters, otherwise /cms/index/index
        parameter.cObject = COA
        parameter.cObject {
          10 = TEXT
          10 {
            wrap = mage:/|/
            value = cms
            override.data = GP:route // register:tx_typogento.content.route
          }
          20 = TEXT
          20 {
            wrap = |/
            value = index
            override.data = GP:controller // register:tx_typogento.content.controller
          }
          30 = TEXT
          30 {
            wrap = |/
            value = index
            override.data = GP:action // register:tx_typogento.content.action
          }
          40 = TEXT
          40 {
            wrap = id/|/
            data = GP:id // register:tx_typogento.content.id
            if.isTrue.data = GP:id // register:tx_typogento.content.id
          }
        }

         # Excludes primary route parameters (see above)
        addQueryString = 1
        addQueryString.exclude = route,controller,action,id
      }

       # Sets the route section
      section = dispatch
    }

    # The render route
    20 {
        # The default priority is 0
        priority = 0

        # See http://wiki.typo3.org/TSref/if
        filter.isTrue = 1

        # See http://wiki.typo3.org/TSref/typolink
        target {
            # Targets the current page
            parameter.data = TSFE:id

            # Adds all query parameter
            addQueryString = 1
        }

        # Sets the route section
        section = render
    }

  }
}

On the Shopping Cart Page ID 30 ( I think here is the problem. I already tried to add stuff like "customer/account/loginPost" to the first Filter)

/**
 * Setup render routes for the Magento onepage checkout
 */
config.tx_typogento {

  routes {

     # Render route for the Ajax action URLs
    100 {

       # See http://wiki.typo3.org/TSref/if
      filter {

         # Filters all Ajax actions
        value = /checkout/onepage/saveMethod/,/checkout/onepage/progress/,/checkout/onepage/saveBilling/,/checkout/onepage/getAdditional/,/checkout/onepage/saveShipping/,/checkout/onepage/saveShippingMethod/,/checkout/onepage/savePayment/,/checkout/onepage/saveOrder/
        isInList.dataWrap = /{GP:route}/{GP:controller}/{GP:action}/
      }

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Targets a prepared page with Ajax support (see https://gist.github.com/3220729)
        #parameter = {$plugin.tx_typogento.ajax.pid}
        parameter = 35

         # Adds all query parameter
        addQueryString = 1
      }

       # Sets the route section
      section = render

       # Sets the priority higher as default
      priority = 1
    }

     # Render route for the success action URL
    110 {

       # See http://wiki.typo3.org/TSref/if
      filter {

         # Filters the success action
        equals = /checkout/onepage/success/
        value.dataWrap = /{GP:route}/{GP:controller}/{GP:action}/
      }

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Targets a prepared page with a TypoGento content plugin
        parameter = 30

         # Adds all query parameter
        addQueryString = 1
      }

       # Sets the route section
      section = render

       # Sets the priority higher as default
      priority = 1
    }
  }
}

and last on the Ajax Page id 35:

/**
 * Setup basic Ajax page
 */
ajax = PAGE
ajax {

   # Set as default type
  typeNum = 0

  config {

     # Disable header code
    disableAllHeaderCode = 1

     # Set content type (RFC 4627)
    additionalHeaders = Content-Type: application/json; charset=utf-8
  }

   # Use TypoGento as output
  10 < plugin.tx_typogento_pi1
  10 {

     # Disable caching
    cache = 0

     # Enable Ajax output
    mode = ajax
  }
}

My realurl_conf.php (Only important Part´s)

'redirects_regex' => array(
        '^catalog\/(.*)$' => 'http://www.domain.de/shop/testkategorie-1/',
    ),
    'postVarSets' => array(
        '_DEFAULT' => array (
            'shoparticle' => array (
                0 => array (
                    'GETvar' => 'tx_fbmagento[shop][s]',
                ),
            ),

            'catalog' => array (
                0 => array (
                    'GETvar' => 'tx_fbmagento[shop][route]',
                ),
                1 => array (
                    'GETvar' => 'tx_fbmagento[shop][controller]',
                ),
                2 => array (
                    'GETvar' => 'tx_fbmagento[shop][action]',
                ),
                3 => array (
                    'GETvar' => 'tx_fbmagento[shop][id]',
                    'userFunc' => 'EXT:fbmagento/lib/class.tx_fbmagento_realurl.php:&tx_fbmagento_realurl->idRewrite',
                ),
                4 => array (
                    'GETvar' => 'tx_fbmagento[shop][product]',
                ),

            ),

When i add a plugin with "Benutzerdefiniert=>Customer=>account=>logout" it does not logg me out correctly to.

What to to?

I have a workaround to use the Shop till i can fix this, i just have the Shopping Card dissabled until FE Login, and the users need to login via the Plugin first ("Benutzerdefiniert=>customer=>account=>login") which works.

Smucks commented 11 years ago

FYI: http://www.webguys.de/wp-content/uploads/2011/05/Checkout-verstehen-und-optimieren.pdf

It seems that the route is: "customer/account/loginPost"

witrin commented 11 years ago

It seems that you use for each of your page an other routing setup. I would recommend to create one routing template setup and use this in your root template, especially the dispatch route (10); but also the common settings, which I've removed from your report for the purpose of clarity.

For login via the one page checkout, I had always just used a plugin with custom:onepage/checkout/index on a separate page and added the following render entries to the routing template setup:

    200 {
        filter {
            value.dataWrap = /{GP:route}/{GP:controller}/
            equals = /checkout/onepage/

            isTrue.cObject = COA
            isTrue.cObject {
                10 = TEXT
                10.value = 1
                10.if.value.data = GP:action
                10.if.equals = index
                20 = TEXT
                20.value = 1
                20.if.value.data = GP:action
                20.if.equals = 
            }
        }
        target {
            parameter = {$site.navigation.entries.checkout} # your checkout page
            addQueryString = 1
            addQueryString.exclude = tx_typogento[route],tx_typogento[controller],tx_typogento[action]
            useCacheHash = 0
        }
        section = render
        priority = 1
    }
    210 {
        filter {
            value.dataWrap = /{GP:route}/{GP:controller}/
            equals = /checkout/onepage/

            isTrue.cObject = COA
            isTrue.cObject {
                10 = TEXT
                10.value = 1
                10.if.value.data = GP:action
                10.if.equals = success
            }
        }
        target {
            parameter = {$site.navigation.entries.checkout} # your checkout page
            addQueryString = 1
            addQueryString.exclude = tx_typogento[route],tx_typogento[controller]
            useCacheHash = 0
        }
        section = render
        priority = 1
    }

They map just all rendered URLs of checkout/onepage/, checkout/onepage/index and checkout/onepage/success to your checkout page; without using the route, controller and action parameter respectively the route and controller parameter, just for nicer URLs. Maybe the isTrue filter could be written easier with TypoScript, it is also possible to use just one routing entry without producing 'nice' URLs.

Therewith when you go to the page with your filled cart, the checkout button should link to your checkout page for registered (with login) or unregistered (without login) checkout.

The realur_conf.php you've posted is unfortunatelly useless, because you use the paramters of the old plugin (tx_fbmagento).

What about the logout? For me it has always worked.

Smucks commented 11 years ago

Okay. Now i have:

I have one TS Template with the routings (I cleared the basic stuff out too :) )

/**
 * Setup generic routes for dispatching and rendering
 */
config.tx_typogento {

   # Similar to Flagbit's TypoGento routing without Ajax support
  routes {

     # The dispatch route
    10 {

       # See http://wiki.typo3.org/TSref/if
      filter.isTrue = 1

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Overrules FlexForm parameters with GET parameters, otherwise /cms/index/index
        parameter.cObject = COA
        parameter.cObject {
          10 = TEXT
          10 {
            wrap = mage:/|/
            value = cms
            override.data = GP:route // register:tx_typogento.content.route
          }
          20 = TEXT
          20 {
            wrap = |/
            value = index
            override.data = GP:controller // register:tx_typogento.content.controller
          }
          30 = TEXT
          30 {
            wrap = |/
            value = index
            override.data = GP:action // register:tx_typogento.content.action
          }
          40 = TEXT
          40 {
            wrap = id/|/
            data = GP:id // register:tx_typogento.content.id
            if.isTrue.data = GP:id // register:tx_typogento.content.id
          }
        }

         # Excludes primary route parameters (see above)
        addQueryString = 1
        addQueryString.exclude = route,controller,action,id
      }

       # Sets the route section
      section = dispatch
    }

    # The render route
    20 {
        # The default priority is 0
        priority = 0

        # See http://wiki.typo3.org/TSref/if
        filter.isTrue = 1

        # See http://wiki.typo3.org/TSref/typolink
        target {
            # Targets the current page
            parameter.data = TSFE:id

            # Adds all query parameter
            addQueryString = 1
        }

        # Sets the route section
        section = render
    }

    # Render route for the Ajax action URLs
    100 {

       # See http://wiki.typo3.org/TSref/if
      filter {

         # Filters all Ajax actions
        value = /checkout/onepage/saveMethod/,/checkout/onepage/progress/,/checkout/onepage/saveBilling/,/checkout/onepage/getAdditional/,/checkout/onepage/saveShipping/,/checkout/onepage/saveShippingMethod/,/checkout/onepage/savePayment/,/checkout/onepage/saveOrder/
        isInList.dataWrap = /{GP:route}/{GP:controller}/{GP:action}/
      }

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Targets a prepared page with Ajax support (see https://gist.github.com/3220729)
        #parameter = {$plugin.tx_typogento.ajax.pid}
        parameter = 35

         # Adds all query parameter
        addQueryString = 1
      }

       # Sets the route section
      section = render

       # Sets the priority higher as default
      priority = 1
    }

     # Render route for the success action URL
    110 {

       # See http://wiki.typo3.org/TSref/if
      filter {

         # Filters the success action
        equals = /checkout/onepage/success/
        value.dataWrap = /{GP:route}/{GP:controller}/{GP:action}/
      }

       # See http://wiki.typo3.org/TSref/typolink
      target {

         # Targets a prepared page with a TypoGento content plugin
        parameter = 30

         # Adds all query parameter
        addQueryString = 1
      }

       # Sets the route section
      section = render

       # Sets the priority higher as default
      priority = 1
    }

    200 {
        filter {
            value.dataWrap = /{GP:route}/{GP:controller}/
            equals = /checkout/onepage/

            isTrue.cObject = COA
            isTrue.cObject {
                10 = TEXT
                10.value = 1
                10.if.value.data = GP:action
                10.if.equals = index
                20 = TEXT
                20.value = 1
                20.if.value.data = GP:action
                20.if.equals = 
            }
        }
        target {
            parameter = 30 # your checkout page
            addQueryString = 1
            addQueryString.exclude = tx_typogento[route],tx_typogento[controller],tx_typogento[action]
            useCacheHash = 0
        }
        section = render
        priority = 1
    }

    210 {
        filter {
            value.dataWrap = /{GP:route}/{GP:controller}/
            equals = /checkout/onepage/

            isTrue.cObject = COA
            isTrue.cObject {
                10 = TEXT
                10.value = 1
                10.if.value.data = GP:action
                10.if.equals = success
            }
        }
        target {
            parameter = 30 # your checkout page
            addQueryString = 1
            addQueryString.exclude = tx_typogento[route],tx_typogento[controller]
            useCacheHash = 0
        }
        section = render
        priority = 1
    }

  }
}

Ajax Template is still the same.

I think i get something wrong ... but what?

Smucks commented 11 years ago

Closed, it works. I will publish a solution soon.